Esempio n. 1
0
def test_parse_input_hp_maxp_missing():
    ui = UI()
    with pytest.raises(SystemExit):
        ui = UI()
        args = ui._UI__parse_input([
            'hp', '-div', '-bw', '64', '-power', '-t', '90.23', '-minr', '1',
            '-maxr', '2', '-minp', '3'
        ])
Esempio n. 2
0
def hm(image_path_1, image_path_2):
    if (image_path_2 == ''):
        ui = UI()
        ui.load_img(image_path_1, label="source", row=1, col=0)
        ui.create_hm_single_buttons(row=4, col=1)
        ui.load_img(image_path_1, label="result", row=4, col=0)
        ui.start()
    else:
        ui = UI()
        ui.load_img(image_path_1, label="source", row=1, col=0)
        ui.load_img(image_path_2, label="target", row=1, col=1)
        ui.create_hm_buttons(row=4, col=1)
        ui.load_img(image_path_1, label="result", row=4, col=0)
        ui.start()
Esempio n. 3
0
    def _initme(self, userdata=None):
        #the main classes
        self.m = Model(self)
        self.capture = Capture(self)
        self.ui = UI(self)

        return False
Esempio n. 4
0
def main():

    drone = tello.Tello('192.168.10.2', 8889)
    vplayer = UI(drone, "./img/")

    # start the Tkinter mainloop
    vplayer.root.mainloop()
Esempio n. 5
0
    def __init__(self):
        reload(sys)
        sys.setdefaultencoding('UTF-8')

        self.title = 'Nada'
        self.model = ['luoo 落网', 'echo 回声', 'nada 收藏', '关于']
        self.view = 'menu'
        self.ctrl = 'menu'

        self.offset = 0
        self.index = 0
        self.step = 10
        self.play_id = -1
        self.play_vol = -1

        self.present = []
        self.stack = []

        self.player = Player()
        self.ui = UI()
        self.luoo = Luoo()
        self.echo = Echo()

        self.database = Database()
        self.database.load()
        self.collections = self.database.data['collections'][0]

        self.screen = curses.initscr()
        self.screen.keypad(1)
Esempio n. 6
0
def main():
    #Initialize Game manipulator
    gm = GameManipulator()
    gm.findGamePosition()

    # Check for found game
    if (not gm.offset):
        print 'FAILED TO FIND GAME!'
        return
    gm.focusGame()
    # Initialize UI

    global_stop_event = threading.Event()

    # Init Learner
    learner = Learner(gm, 12, 4, 0.2)
    try:
        # Initialize UI and start the game
        UI(gm, learner, global_stop_event).run()
    except KeyboardInterrupt:
        global_stop_event.set()
        learner.interuptted = True
        # clear log file
        with open('/tmp/ui.log', 'w'):
            pass
        raise SystemExit
Esempio n. 7
0
    def __init__(self):

        # get the display surface
        self.display_surface = pygame.display.get_surface()
        self.game_paused = False
        self.open_game_over = False
        self.open_game_wins = False
        self.inimigos = []

        # sprite group setup
        self.visible_sprites = YSortCameraGroup()
        self.obstacle_sprites = pygame.sprite.Group()

        # attack sprites
        self.current_attack = None
        self.attack_sprites = pygame.sprite.Group()
        self.attackable_sprites = pygame.sprite.Group()

        # sprite setup
        self.create_map()

        # user interface
        self.ui = UI()
        self.upgrade = Upgrade(self.player)

        # particles
        self.animation_player = AnimationPlayer()
        self.magic_player = MagicPlayer(self.animation_player)
Esempio n. 8
0
def main():
    repository = Repository()
    repository.mapp.randomize()
    controller = Controller(repository)
    ui = UI(controller)

    ui.run()
Esempio n. 9
0
    def __init__(self,
                 types=3,
                 max_rounds=5,
                 min_obj=1,
                 max_obj=6,
                 total=10.0):
        self.opponent_list = []

        self.generator = Generator(types, min_obj, max_obj, total)
        self.ui = UI()

        self.types = types
        self.max_rounds = max_rounds
        self.total = total

        self.offers = self.generator.offers
        self.action_space = 1 + len(self.offers)
        self.reward_space = 1

        self.no_consensus_score = 0.68

        state = self.reset()

        # +- on each type, left/right, submit button
        self.observation_space = len(state)
        self.context_space = len(self.get_context())
    def start(self):
        from ui import UI

        self.gameengine.init()

        #n_grid = self.n_grid
        sizeunit = 20
        area = self.gameengine.get_area()
        ui = UI(pressaction=self.pressaction, area=area, sizeunit=sizeunit)

        #ui.setDaemon(True)
        ui.start()

        # for i in range(20):
        #     self.gameengine.update()
        # ui.setarea(area=self.gameengine.get_area(n_grid))

        if self.verbose:
            count = 0

        while not self.gameengine.update():
            if self.verbose:
                count += 1

            time.sleep(self.dt)
            ui.setarea(area=self.gameengine.get_area())

        ui.gameend(self.gameengine.get_score())

        if self.verbose:
            print("Game end with steps [{0}] and score [{1}].".format(
                count, self.gameengine.get_score()))
Esempio n. 11
0
class Test:

    board = Board()
    hmnPlayer = Player('Human')
    cmpPlayer = Player('Computer')
    ruleManager = RuleManager()
    ui = UI()

    def fillTestBoardOne():
        board.fillCoordinate('00', hmnPlayer)
        board.fillCoordinate('01', hmnPlayer)
        board.fillCoordinate('02', hmnPlayer)
        board.fillCoordinate('13', hmnPlayer)
        board.fillCoordinate('10', cmpPlayer)
        board.fillCoordinate('20', cmpPlayer)
        board.fillCoordinate('21', cmpPlayer)
        board.fillCoordinate('30', cmpPlayer)
        board.fillCoordinate('31', cmpPlayer)
        board.fillCoordinate('32', cmpPlayer)
        board.fillCoordinate('44', cmpPlayer)

    def fillTestBoardTwo():
        for x in range(0, 7):
            for y in range(0, 7):
                board.fillCoordinate(str(x) + str(y), cmpPlayer)

    def fillTestBoardThree():
        board.fillCoordinate('00', hmnPlayer)
Esempio n. 12
0
 def __init__(self, current=0):
     State.__init__(self)
     self.ui = UI(self, Jules_UIContext)
     self.nextState = GameStart
     logo_duration = 20 * 1000
     scores_duration = 5 * 1000
     self.displays = [(logo_duration, self.draw_logo),
                      (scores_duration, self.draw_high_scores)]
     self.eventid = TimerEvents.SplashScreen
     self.current = current
     self.draw = self.displays[self.current][1]
     self.instructions = [
         'Can you think fast and react faster?',
         'This game will test both.',
         'Your job is to destroy the bonus blocks.',
         'Sounds easy, right?... Wrong!', 'There are several problems.',
         'If you destroy a penalty block you lose 200 pts.',
         'If you get 3 penalties, you lose a life.',
         'If you lose 3 lives, the game is over.',
         'The bonus and penalty blocks', 'change colors every 5 seconds.',
         'And on top of that, if you do not destroy a',
         'random non-bonus, non-penalty block every',
         'couple of seconds, that will give you a',
         'penalty too. Think you got all that?'
     ]
Esempio n. 13
0
    def __init__(self, app):
        self.app = app
        builtins.get_local_file = get_local_file

        #insert the game into buildins for easy gui callback
        builtins.game = self

        #stats
        self.stats = Stats()
        builtins.stats = self.stats

        with loading():
            #database
            self.db = Database('save.db')
            #init the gui system
            self.gui = UI()
            self.gui.software_cursor()
            #make the main menu
            self.gui.load_from_file(get_local_file('ui/layout.json'))
            self.gui.show_hide([
                'special_frame', 'trait_frame', 'perk_frame', 'skill_frame',
                'stats_frame', 'level_up', 'level_down', 'level_node', 'items',
                'paypal', 'shader', 'save', 'exit'
            ])
            self.stats.update_ui()
Esempio n. 14
0
    def build(self):
        renderer = Renderer()
        controller = Controller(renderer=renderer)
        ui = UI(renderer=renderer, controller=controller)
        controller.setUI(ui)

        return ui
Esempio n. 15
0
def system_test():
    ui = UI()
    result = ui.send(
        "{'System Test': {'func': f.system_test, 'args_in': {}, 'db_use': True, 'loop': False}}"
    )

    return json.dumps(result)
Esempio n. 16
0
def main(args):
    print(c.GROUP_NAME, "Attendance Tracker Version", c.VERSION)
    # Init textMode
    textMode = 1  #1 for text, 0 for UI
    # Process the arguments
    if len(args) > 1:
        arg = args[1].lower()
        if arg == "--help":
            showHelp()
            sys.exit(0)
        elif arg == "--version":
            showVersion()
            sys.exit(0)
        elif arg == "--nogui":
            textMode = 1
        else:
            print("Invalid argument:", args[1])
            sys.exit(0)

    # Start the program into either textmode or GUI mode
    if textMode == 0:
        global app
        app = UI(args)
        app.exec_()
    else:
        TextUI().start()

    # Exit normally
    sys.exit(0)
Esempio n. 17
0
 def start(self):
     ui = UI()
     if ui.server_check() is False:
         self.main()
     else:
         logging.info(
             'Startup Failed -- ShakeCast Server is already started')
Esempio n. 18
0
def main(flag):
    bits = 1024
    hackers = ['neo', 'trinity', 'morpheus']
    difficulty = 10
    lifes_count = 3
    ui = UI(flag, bits, hackers, difficulty, lifes_count)
    ui.run()
Esempio n. 19
0
    def __init__(self):
        super().__init__()
        pygame.init()

        self.EVENTS = {
            pygame.QUIT: self.on_quit,
            pygame.VIDEORESIZE: self.on_resize,
            pygame.MOUSEBUTTONDOWN: self.mouse_event("down"),
            pygame.MOUSEBUTTONUP: self.mouse_event("up"),
            pygame.MOUSEMOTION: self.mouse_event("move"),
            pygame.KEYDOWN: self.on_key
        }

        self.mousedown = {b: False for b in ("l", "r", "m")}
        self.mousedrag = {b: False for b in ("l", "r", "m")}

        pygame.display.set_caption("Solitaire")
        pygame.display.set_icon(assets.get_icon())
        self.screen = pygame.display.set_mode(
            (constants.WIDTH, constants.HEIGHT),
            constants.SCREEN_FLAGS,
            vsync=True)
        self.clock = pygame.time.Clock()
        assets.load_svgs()
        self.game = None
        self.ui = UI(self)
        self.on_resize(
            pygame.event.Event(pygame.VIDEORESIZE,
                               size=(constants.WIDTH, constants.HEIGHT)))

        self.running = True
Esempio n. 20
0
 def run_ui(self): 
     
     self._ui = UI(self._config_manager.ui,  #dict 
                   self._config_manager.content_db,
                   self._server, 
                   self._synchronizer)
     self._ui.run()
Esempio n. 21
0
def main():
    files = read_txt_config_file("settings.properties")
    movies_files = FileRepository(files["movies"], Movie.read_movie,
                                  Movie.write_movie, files[0])
    clients_files = FileRepository(files["clients"], Client.read_client,
                                   Client.write_client, files[0])
    rentals_files = FileRepository(files["rentals"], Rental.read_rental,
                                   Rental.write_rental, files[0])

    #tests = Tests()
    #tests.run_tests()
    undo_repository = UndoRepository()
    undo_service = UndoService(undo_repository)
    movie_validator = MovieValidator()
    movie_repository = MovieRepository(movies_files)
    movie_service = MovieService(movie_repository, movie_validator,
                                 undo_repository)
    client_validator = ClientValidator()
    client_repository = ClientRepository(clients_files)
    client_service = ClientService(client_repository, client_validator,
                                   undo_repository)
    rental_validator = RentalValidator()
    rental_repository = RentalRepository(rentals_files)
    rental_service = RentalService(rental_repository, rental_validator,
                                   client_repository, movie_repository,
                                   undo_repository)
    ui = UI(movie_service, client_service, rental_service, undo_service)
    ui.main()
Esempio n. 22
0
 def __init__(self):
     self.query = StudentQuery("data.db")
     self.ui = UI()
     self.ui.bind_remove_button(self.__delete_student)
     self.ui.bind_submit_button(self.__update_student)
     self.ui.bind_table_selection(
         lambda student_id: self.query.find_student_by_id(student_id))
Esempio n. 23
0
def test_parse_input_circuit_type_missing():
    ui = UI()
    with pytest.raises(SystemExit):
        args = ui._UI__parse_input([
            '-mul', '-bw', '32', '-delay', '-t', '23', '-mina', '0', '-maxa',
            '10'
        ])
Esempio n. 24
0
    def start_ai(self):
        '''
        Start to play "Five or more" game for human
        '''
        Nx, Ny, channel = self.state_shape
        self.gameboard = Board(board_shape=(Nx, Ny))
        self.gameboard.init()

        board = self.gameboard.get_board()
        self.boards.append(board)
        self.update_states()

        state = self.get_state()
        availables = self.gameboard.get_availables()
        action = self.ai.play(state, availables)

        if self.verbose:
            print("Initiating UI...")

        from ui import UI, init_ui
        app = init_ui()
        self.ui = UI(pressaction=self.pressaction_ai,
                     board=self.gameboard.get_board(),
                     sizeunit=50)
        app.exec_()
Esempio n. 25
0
def test_parse_input_operation_missing():
    ui = UI()
    with pytest.raises(SystemExit):
        args = ui._UI__parse_input([
            'lp', '-bw', '32', '-delay', '-t', '23', '-mina', '0', '-maxa',
            '10'
        ])
Esempio n. 26
0
def main():
    global arg_parser
    args = _setupArgs()
    if not any(vars(args).values()):  # no argument given
        #arg_parser.print_help()
        from ui import UI
        UI().run()
        return 0

    if not args.debug: log.setLevel(logger.logging.INFO)
    if args.license: print(LICENSE)
    app = App()

    if args.list_codecs: app.list_codecs()
    app.readOnly = args.dry_run
    if app.readOnly: log.info("Dry run; not writing any files!")
    for arg in args.list:
        app.list_file(*arg)
    for arg in args.list_recursive:
        app.list_file_recursive(*arg)
    for arg in args.extract:
        app.extract_file(*arg)
    for arg in args.extract_recursive:
        app.extract_recursive(*arg)
    for arg in args.show_xml:
        app.show_xml(*arg)
    return 0
Esempio n. 27
0
def main():
    # Load recorder config from file and update displayed status on UI
    recr = Recorder()
    recr.read_config()
    recr.update_status()

    # Load clipper config from file and update displayed status on UI
    clpr = Clipper()
    clpr.read_config()
    clpr.update_status()

    app = QApplication(sys.argv)
    app.setApplicationName('Live Audio Tool')
    app.setApplicationDisplayName('Live Audio Tool')

    ex = UI(clpr, recr)
    ex.show()
    app.exec_()

    # Ensure recorder is stopped
    recr.is_recording = False

    # Wait to ensure all clip exports are finished
    time.sleep(clpr.post_buffer)

    sys.exit()
    def start(self):
        self.curState = 'strategy'
        ui = self.ui = UI()
        while True:
            os.system('clear')
            print "Player %s\nMoney: %4.2f\nArmy size: %d\nBuilding count: %d" % (
                self.player.name, self.player.money, len(
                    self.player.army), len(self.player.buildings))

            print "Menu:"
            print "====="
            if self.curState == "strategy":
                dOpts = [("List buildings", self.listCurrentBuildings),
                         ("List army", self.listCurrentSoldiers),
                         ("Buy building", self.buyBuilding),
                         ("Buy soldier", self.buySoldier),
                         ("Train soldiers", self.trainSoldiers),
                         ("Quit", lambda: None)]

                # DEBUG LINES
                #print str(dOpts)

                sRes = ui.menu(dOpts)
                if sRes == None:
                    return
                else:
                    print sRes
                    print "Press [ENTER] to continue"
                    raw_input()
Esempio n. 29
0
def get_ui_from_properties(settings, game):
    if settings['ui'] == 'gui':
        window_width = int(settings['window_width'])
        window_height = int(settings['window_height'])
        window_title = settings['window_title']
        return GUI(game, window_width, window_height, window_title)
    elif settings['ui'] == 'console':
        return UI(game)
Esempio n. 30
0
    def SvcStop(self):
        self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
        win32event.SetEvent(self.stop_event)
        logging.info('Stopping ShakeCast Server...')
        self.stop_requested = True

        ui = UI()
        ui.send('shutdown')