def __init__(self, parent):
        super().__init__(parent)
        self.setupUi(self)

        self.curr_pixmap = None
        self.game_config = load_game_databases()

        self.game_combobox.currentIndexChanged.connect(
            self.init_resolution_list)
        self.resolution_combobox.currentIndexChanged.connect(self.init_status)

        self.start_button.clicked.connect(self.start)
        self.stop_button.clicked.connect(self.stop)
        self.stop_button.setEnabled(False)

        # ------

        self.window_chosen_refresh_button.clicked.connect(
            self.refresh_window_title_list)
        self.refresh_window_title_list()

        self.status_table.setColumnCount(2)
        self.status_table.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.status_table.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.status_table.horizontalHeader().setSectionResizeMode(
            QHeaderView.Stretch)
        self.status_table.resizeRowsToContents()
        self.status_table.resizeColumnsToContents()
        self.status_table.verticalHeader().setHidden(True)
        self.prepare_status_table()

        # ------
        self.init_game_list()
Example #2
0
 def load_data(self):
     self.game_databases = load_game_databases()
     self.game_window = GameWindow('明日方舟 - MuMu模拟器')
     self.game_executor = Executor(
         game_config=self.game_databases['Arknights']['1920x1080'],
         game_window=self.game_window)
     self.game_executor.game_state_changed.connect(
         self.status_widget.set_current_status)
     self.game_executor.action_executed.connect(
         self.status_widget.set_current_action)
     self.game_executor.screenshot_catched.connect(
         self.status_widget.set_current_screenshot)
Example #3
0
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setupUi(self)

        self.game_config = load_game_databases()

        self.game_combobox.currentIndexChanged.connect(
            self.init_resolution_selector)
        self.init_game_selector()
        self.load_button.clicked.connect(self.load_button_clicked)

        self.state_edit_widget = StatusEditWidget(self)
        self.state_edit_widget.hide()
        self.main_layout.addWidget(self.state_edit_widget)

        self.action_edit_widget = ActionEditWidget(self)
        self.action_edit_widget.hide()
        self.main_layout.addWidget(self.action_edit_widget)

        self.web_view = QWebEngineView(self)
        self.web_channel = QWebChannel(self.web_view.page())
        self.web_channel.registerObject('configWidget', self)
        self.web_view.page().setWebChannel(self.web_channel)
        self.web_view.load(QUrl('qrc:/resource/html/draw.html'))
        self.main_layout.addWidget(self.web_view)

        self.current_config = None  # type: GameConfig

        self.action_listWidget.currentItemChanged.connect(
            self.action_click_changed)
        self.state_listWidget.currentItemChanged.connect(
            self.state_click_changed)

        self.state_add_toolButton.clicked.connect(self.add_default_state)
        self.action_add_toolButton.clicked.connect(self.add_default_action)

        self.buttonBox.accepted.connect(self.save_current_config)
        self.state_edit_widget.status_saved.connect(self.save_game_state)
        self.action_edit_widget.action_saved.connect(self.save_game_action)
                                    'Condition image is empty!',
                                    QMessageBox.Ok)
            return False
        return True

    def save_button_clicked(self):
        if self.check_legal():
            self.action_saved.emit(self.collect_data())

    def collect_data(self):
        return {
            'name': self.name_lineEdit.text(),
            'to': self.to_comboBox.currentText(),
            'from': self.from_comboBox.currentText(),
            'condition': self.area_condition.text(),
            'img': self.img
        }


if __name__ == '__main__':
    app = QApplication(sys.argv)
    w = ActionEditWidget()

    game_config = load_game_databases()
    w.show()
    w.load_action(
        game_config['Arknights']['1920x1080'].game_action_dict['开始行动'],
        game_config['Arknights']['1920x1080'].game_state_dict.keys())

    app.exec()