Beispiel #1
0
 def spawn(self, query, menu_src):
     if system() == 'Windows':
         # FIXME required for better perf
         # BUG affects only intial window instance
         # if query in _registered_contextmenus:
         #   self.current_window.ContextMenu = _registered_contextmenus[query]
         #   self.current_window.ContextMenu.IsOpen = True
         # else:
         cm = ContextMenu()
         _registered_contextmenus[query] = cm
         self.current_window.ContextMenu = cm
         create_menu(cm, menu_src, self.context.evaluate_script)
         cm.HorizontalOffset = 7
         cm.IsOpen = True
     elif system() == 'Linux':
         # FIXME required for better perf
         # BUG affects only intial window instance
         # if query in _registered_contextmenus:
         #   self.context.popup = _registered_contextmenus[query]
         #   self.context.connect('button-release-event', self.button_release_event)
         # else:
         self.context.popup = Gtk.Menu()
         create_menu(self.context.popup, menu_src,
                     self.context.evaluate_script)
         self.context.popup.show_all()
         self.context.connect('button-release-event',
                              self.button_release_event)
         _registered_contextmenus[query] = self.context.popup
def create_an_item():
    number = int(input('Enter a number: '))
    name = input('Enter a name: ').capitalize()
    description = input('Enter a description: ').capitalize()
    ingredient = input('Enter ingredient: ').capitalize()
    price = input('Enter a price:$ ')
    menu.create_menu(number, name, description, ingredient, price)
Beispiel #3
0
 def test_menu_delete_menu_menu_should_delete(self):
     #arrange
     self.number = 'number'
     self.name = 'name'
     self.description = 'description'
     self.ingredient = 'ingredient'
     self.price = 'price'
     #act
     menu.create_menu(self.number, self.name, self.description,
                      self.ingredient, self.price)
     self.assertTrue(menu.delete_menu(self.number))
Beispiel #4
0
    def test_create_menu_should_create_menu(self):
        self.number = 'number'
        self.name = 'name'
        self.description = 'description'
        self.ingredient = 'ingredient'
        self.price = 'price'

        #act
        menu.create_menu(self.number, self.name, self.description,
                         self.ingredient, self.price)
        actual = len(menu.menu_list)
        expected = 1

        #assert
        self.assertEqual(expected, actual)
Beispiel #5
0
def checking_login(username, password,root):
    for usuario in menu.user_list:
        if usuario.dni == username:
            if usuario.password == password:
                message = "Bienvenido/a " + usuario.name

                usuario1 = usuario
                tkinter.messagebox.showinfo("Login", message)
                menu.create_menu(root, usuario1)

            else:
                message = "Password equivocada"
            break
        else:
            message = "Has sido hackeado, tu password es " + password
Beispiel #6
0
def death(win):
    global done, icebergs, moves, steps
    pygame.time.wait(200)
    screen = pygame.display.set_mode((xres, yres))
    if win:
        victory(screen, xres, yres)
    else:
        lose(screen, xres, yres)
    write_name(get_name(), len(path))
    if time == 6 and steps == 66:
        snake()
    bg = pygame.image.load('menu_bg.png')
    bg = pygame.transform.scale(bg, (xres, yres))
    screen.blit(bg, (0, 0))
    moves_string = ''
    for i in range(len(moves)):
        moves_string += ','.join(map(str,
                                     ceil(array(moves[i])).astype(int))) + '->'
    moves_string += ','.join(map(str, ceil(array(moves[-1])).astype(int)))
    myfont = pygame.font.SysFont('Comic Sans MS', 25)
    for i in range(len(moves_string) // 50 + 1):
        current = moves_string[i * 50:min((i + 1) * 50, len(moves_string))]
        if i > 10:
            current += '...'
        screen.blit(myfont.render(current, False, (255, 255, 255)),
                    (0, i * 25))
        end = i * 25
        if i > 10:
            break
    myfont = pygame.font.SysFont('Comic Sans MS', 30)
    end += 50
    screen.blit(
        myfont.render('Всего шагов: ' + str(steps), False, (255, 255, 255)),
        (xres / 2 - 150, end))
    end += 50
    screen.blit(
        myfont.render('Нажмите любую клавишу чтобы продолжить', False,
                      (255, 255, 255)), (20, end))
    done = False
    while not done:
        pygame.display.flip()
        for event in pygame.event.get():
            if event.type == pygame.KEYDOWN:
                done = True
    pygame.display.flip()
    mode = create_menu(screen, xres, yres, current_settings)
    if mode == -1:
        done = True
    else:
        done = False
        icebergs = []
        moves = [[0, 0]]
        steps = 0
        start(mode)
    def OnContextMenu(self, e):
        item = self.HitTest(self.ScreenToClient(e.GetPosition()))
        self.Selection = item
        self.Refresh()

        if not hasattr(self, 'itemContext'):
            menuItems = [
                (wx.ID_EDIT,),
                (wx.ID_DELETE,),
            ]

            self.itemContext = menu.create_menu(wx.Menu, menuItems)
            self.Bind(wx.EVT_MENU, self.OnMenuEvent)

        self.PopupMenu(self.itemContext)
Beispiel #8
0
 def get(self, request, *args, **kwargs):
     result = menu.create_menu()
     return HttpResponse(result)
Beispiel #9
0
def volver(root, usuario):
    tkinter.messagebox.showinfo("Volver", "Volviendo al menu principal")
    menu.create_menu(root, usuario)
Beispiel #10
0
    # criando uma lista de hud das vidinhas, botei uma tortuguinha
    global lives_hud
    lives_hud = []
    for i in range(0, 3):
        live_hud = create_hud("turtle", "red")
        live_hud.goto(-330 + (30 * i), 265)
        lives_hud.append(live_hud)
    screen.update()


i = 0
while hasLives:
    if state == "menu":
        option = []
        create_screen()
        create_menu(screen, option)
        state = "waiting"

    screen.update()
    if len(option) > 0:
        if option[0] == "Iniciar" and state == "waiting":
            draw_game()
            wait()
            set_state("playing")
        if option[0] == "Sair" and state == "waiting":
            sys.exit(0)

    if state == "starting":
        if (i == 0):
            wait()
            set_state("playing")
Beispiel #11
0
    def __init__(self, window):
        self.menu = Gtk.MenuBar.new()

        create_menu(self.menu, window.config['menu'],
                    window.webview.evaluate_script)
Beispiel #12
0
        mouse_position = pygame.mouse.get_pos()
        player.update_turret_rotation(
            (mouse_position[0] - width // 2, mouse_position[1] - height // 2))
        keys = pygame.key.get_pressed()
        if keys is not None:
            player.move(keys)

        mouse_pressed = pygame.mouse.get_pressed()
        new_bullet = None
        if mouse_pressed[0] and turret_reload_cooldown == 0:
            new_bullet = Bullet(player.x + 60 * cos(player.turret_rotation),
                                player.y - 60 * sin(player.turret_rotation),
                                player.turret_rotation)
            turret_reload_cooldown = turret_reload_speed

        if turret_reload_cooldown != 0:
            turret_reload_cooldown -= 1

        data = network.send((player, new_bullet))
        if data:
            graphics_handler.update_display(data, player.x, player.y, trees)
        else:
            running = False


if __name__ == "__main__":
    run_game, server_address, player_name = create_menu()
    if run_game:
        game_loop(server_address, player_name)
Beispiel #13
0
 def get(self, request, *args, **kwargs):
     result = menu.create_menu()
     return HttpResponse(result)
Beispiel #14
0
    def __init__(self, window):

        self.IsMainMenu = True

        create_menu(self, window.config['menu'],
                    window.webview.evaluate_script)
Beispiel #15
0
        while s:
            s[0] = int(s[0])
            arr.append(s)
            s = inp.readline().rstrip().split()
        inp.close()
    except:
        pass
    arr.append([score, name])
    arr.sort(reverse=True)
    out = open('scores.txt', 'w')
    for i in range(min(5, len(arr))):
        print(arr[i][0], arr[i][1], file=out)
    out.close()


mode = create_menu(screen, xres, yres)
done = True
if mode != -1:
    global moves, steps
    done = False
    moves = [[0, 0]]
    steps = 0
    start(mode)

while not done:
    for event in pygame.event.get():
        if event.type == pygame.KEYDOWN:
            if event.key == pygame.K_ESCAPE:
                death(False)
            elif (event.key == pygame.K_w or event.key == pygame.K_a
                  or event.key == pygame.K_s or event.key == pygame.K_d