Пример #1
0
    def __init__(self, game):
        """Class initialization.

        :param lib.game.game.Game game: instance of game.
        """
        super().__init__()
        self.setupUi(self)
        self.setFixedSize(self.width(), self.height())
        set_default_icon(window=self)
        self.game = game
        self.setWindowModality(Qt.ApplicationModal)
        self.events = get_events(game)
        self.actions = get_actions(game)
        self.missions = get_missions(game)
        self.modes = [*self.events, *self.actions, *self.missions]
        self.queue_item = None
        self.current_mode = None
        self.editor_button_box.accepted.connect(self.render_queue_item)

        menu_dict = {
            **get_actions_dict(self.actions),
            "[EVENTS]": self.events,
            **get_missions_dict(self.missions)
        }
        menu = QMenu()
        self.populate_menu(menu=menu, dictionary=menu_dict)
        self.select_mode_tool_button.setPopupMode(QToolButton.InstantPopup)
        self.select_mode_tool_button.setMenu(menu)
Пример #2
0
def create_updater_notification():
    from PyQt5.QtWidgets import QDialog
    from lib.gui.designes.updater_notification import Ui_Dialog
    from lib.gui.helper import set_default_icon
    notification = QDialog()
    Ui_Dialog().setupUi(Dialog=notification)
    set_default_icon(window=notification)
    return notification
Пример #3
0
 def __init__(self):
     """Class initialization."""
     super().__init__()
     self.setupUi(self)
     set_default_icon(window=self)
     win32gui.EnumWindows(self.get_processes_info, None)
     self.timer = Timer()
     self.timer.set_timer(self.update_processes_thumbnails)
     self.emulators_list_widget.itemClicked.connect(self.on_item_select)
     self.selected_emulator = None
     self.selected_emulator_process = None
     self.next_button.clicked.connect(self.run_game_setup)
     self.setup_game = None
Пример #4
0
    def __init__(self, emulator):
        """Class initialization.

        :param lib.emulators.android_emulator.AndroidEmulator: instance of game emulator.
        """
        super().__init__()
        self.setupUi(self)
        set_default_icon(window=self)
        self.emulator = emulator
        self.game = Game(self.emulator)
        self.screen_image = ScreenImageLabel(widget=self.screen_image_label,
                                             emulator=self.emulator)
        self.set_visibility_to_all(True)
        self.is_game_opened_q()
        self.game_app_rect = None  # type: Rect
        self.screen_image_label.mousePressEvent = self.screen_click_event
        self.ready_to_press = False
Пример #5
0
    def __init__(self, file_logger, settings):
        """Class initialization.

        :param logging.FileHandler file_logger: file handler of log-file.
        :param PyQt5.QtCore.QSettings.QSettings settings: GUI settings.
        """
        super().__init__()
        self.setupUi(self)
        set_default_icon(window=self)
        self.settings = settings
        self._init_window_settings()
        self.emulator_name, self.emulator_type, self.game_app_rect, self.emulator, self.game = None, None, None, None, None
        self.load_settings_from_file()
        self.game.file_logger_name = None
        if file_logger:
            self.game.file_logger_name = file_logger.baseFilename
            self.logger = QTextEditFileLogger(
                all_logger_widget=self.logger_text,
                info_logger_widget=self.logger_text_info,
                error_logger_widget=self.logger_text_error,
                log_file=file_logger.baseFilename)
        else:
            self.logger_text.setPlainText(
                "Cannot create log file because `logs` folder doesn't exists.")
        run_and_stop_button = self.create_blockable_button(
            button=self.run_queue_button)
        self.queue_list = QueueList(list_widget=self.queue_list_widget,
                                    run_and_stop_button=run_and_stop_button,
                                    add_button=self.add_queue_button,
                                    edit_button=self.edit_queue_button,
                                    remove_button=self.remove_queue_button,
                                    game=self.game,
                                    queue_selector_buttons=[
                                        self.queue_button_1,
                                        self.queue_button_2,
                                        self.queue_button_3,
                                        self.queue_button_4
                                    ])
        self.screen_image = ScreenImageLabel(emulator=self.emulator,
                                             widget=self.screen_label)
        self.acquire_heroic_quest_rewards_checkbox.stateChanged.connect(
            self.acquire_heroic_quest_rewards_state_changed)
        self.mission_team_spin_box.valueChanged.connect(
            self.mission_team_changed)
        self.timeline_team_spin_box.valueChanged.connect(
            self.timeline_team_changed)
        self.threads = ThreadPool()
        self._user_name_acquired = False
        self.background_functions_to_run()
        self.background_timer = Timer()
        self.background_timer.set_timer(self.background_functions_to_run,
                                        timer_ms=5000)
        self.blockable_buttons = [
            self.run_queue_button, self.add_queue_button,
            self.edit_queue_button, self.remove_queue_button
        ]
        self.tasks = []
        self.create_tasks()

        if self.emulator.initialized and self.emulator.restartable:
            if not self.game.is_main_menu() and not BattleBot(
                    self.game, None).is_battle():
                if not self.game.go_to_main_menu():
                    logger.warning(
                        "Can't get to the main menu. Restarting the game just in case."
                    )
                    self.restart_game_button.click()
        self._create_menu_for_recorder()
Пример #6
0
    def __init__(self, file_logger):
        """Class initialization."""
        super().__init__()
        self.setupUi(self)
        set_default_icon(window=self)
        self.emulator_name, self.emulator_type, self.game_app_rect, self.emulator, self.game = None, None, None, None, None
        self.load_settings_from_file()
        self.game.file_logger_name = None
        if file_logger:
            self.game.file_logger_name = file_logger.baseFilename
            self.logger = QTextEditFileLogger(
                logger_widget=self.logger_text,
                log_file=file_logger.baseFilename)
        else:
            self.logger_text.setPlainText(
                "Cannot create log file because `logs` folder doesn't exists.")
        run_and_stop_button = self.create_blockable_button(
            button=self.run_queue_button)
        autoplay_button = self.create_blockable_button(
            button=self.autoplay_button)
        daily_trivia_button = self.create_blockable_button(
            button=self.daily_trivia_button)
        world_boss_invasion_button = self.create_blockable_button(
            button=self.world_boss_invasion_button)
        squad_battle_button = self.create_blockable_button(
            button=self.squad_battle_button)
        danger_room_button = self.create_blockable_button(
            button=self.danger_room_button)
        shield_lab_button = self.create_blockable_button(
            button=self.shield_lab_button)
        restart_game_button = self.create_blockable_button(
            button=self.restart_game_button)
        comic_cards_button = self.create_blockable_button(
            button=self.comic_cards_button)
        custom_gear_button = self.create_blockable_button(
            button=self.custom_gear_button)
        dispatch_mission_button = self.create_blockable_button(
            button=self.dispatch_mission_rewards)
        self.queue_list = QueueList(list_widget=self.queue_list_widget,
                                    run_and_stop_button=run_and_stop_button,
                                    add_button=self.add_queue_button,
                                    edit_button=self.edit_queue_button,
                                    remove_button=self.remove_queue_button,
                                    game=self.game,
                                    queue_selector_buttons=[
                                        self.queue_button_1,
                                        self.queue_button_2,
                                        self.queue_button_3,
                                        self.queue_button_4
                                    ])
        self.autoplay = AutoPlayTask(game=self.game, button=autoplay_button)
        self.daily_trivia = DailyTriviaTask(game=self.game,
                                            button=daily_trivia_button)
        self.world_boss_invasion = WorldBossInvasionTask(
            game=self.game, button=world_boss_invasion_button)
        self.squad_battle = SquadBattleAllTask(game=self.game,
                                               button=squad_battle_button)
        self.danger_room = DangerRoomOneBattleTask(game=self.game,
                                                   button=danger_room_button)
        self.shield_lab = ShieldLabCollectAntimatterOneBattleTask(
            game=self.game, button=shield_lab_button)
        self.restart_game = RestartGameTask(game=self.game,
                                            button=restart_game_button)
        self.comic_cards = ComicCardsTask(game=self.game,
                                          button=comic_cards_button)
        self.custom_gear = CustomGearTask(game=self.game,
                                          button=custom_gear_button)
        self.dispatch_mission = DispatchMissionAcquireTask(
            game=self.game, button=dispatch_mission_button)
        self.screen_image = ScreenImageLabel(emulator=self.emulator,
                                             widget=self.screen_label)
        self.acquire_heroic_quest_rewards_checkbox.stateChanged.connect(
            self.acquire_heroic_quest_rewards_state_changed)
        self.low_memory_mode_checkbox.stateChanged.connect(
            self.low_memory_mode_state_changed)
        self.mission_team_spin_box.valueChanged.connect(
            self.mission_team_changed)
        self.timeline_team_spin_box.valueChanged.connect(
            self.timeline_team_changed)
        self.threads = ThreadPool()
        self._user_name_acquired = False
        self.update_labels()
        self.label_timer = Timer()
        self.label_timer.set_timer(self.update_labels, timer_ms=5000)
        self.blockable_buttons = [
            self.run_queue_button, self.add_queue_button,
            self.edit_queue_button, self.remove_queue_button,
            self.squad_battle_button, self.world_boss_invasion_button,
            self.daily_trivia_button, self.autoplay_button,
            self.danger_room_button, self.shield_lab_button,
            self.restart_game_button, self.comic_cards_button,
            self.custom_gear_button, self.dispatch_mission_rewards
        ]
        self.tasks = [
            self.autoplay, self.daily_trivia, self.world_boss_invasion,
            self.squad_battle, self.danger_room, self.shield_lab,
            self.restart_game, self.comic_cards, self.custom_gear,
            self.dispatch_mission
        ]

        if self.emulator.initialized and self.emulator.restartable:
            if not self.game.is_main_menu() and not BattleBot(
                    self.game, None).is_battle():
                if not self.game.go_to_main_menu():
                    logger.warning(
                        "Can't get to the main menu. Restarting the game just in case."
                    )
                    self.restart_game_button.click()
        self._create_menu_for_recorder()