async def _import_permalink(self): from randovania.gui.dialog.permalink_dialog import PermalinkDialog dialog = PermalinkDialog() result = await async_dialog.execute_dialog(dialog) if result == QtWidgets.QDialog.Accepted: permalink = dialog.get_permalink_from_field() await self.generate_seed_from_permalink(permalink)
def test_on_permalink_changed_permalink_different_str(skip_qtbot, mocker): mock_from_str: MagicMock = mocker.patch("randovania.layout.permalink.Permalink.from_str") mock_from_str.return_value.as_base64_str = "!permalink_wrong" dialog = PermalinkDialog() skip_qtbot.addWidget(dialog) # Run dialog._on_permalink_changed("") # Assert assert not dialog.accept_button.isEnabled() assert dialog.import_error_label.text() == "Invalid permalink: Imported permalink is different from text field."
def test_on_permalink_changed(skip_qtbot, mocker, valid): mock_from_str: MagicMock = mocker.patch("randovania.layout.permalink.Permalink.from_str") mock_from_str.return_value.as_base64_str = "" if not valid: mock_from_str.side_effect = ValueError("Invalid permalink") dialog = PermalinkDialog() dialog.permalink_edit.setText("") skip_qtbot.addWidget(dialog) # Run dialog._on_permalink_changed("") # Assert assert dialog.accept_button.isEnabled() == valid
async def _import_permalink(self): dialog = PermalinkDialog() result = await async_dialog.execute_dialog(dialog) if result == QDialog.Accepted: permalink = dialog.get_permalink_from_field() await self.generate_seed_from_permalink(permalink)
def _import_permalink(self): dialog = PermalinkDialog() result = dialog.exec_() if result == QDialog.Accepted: permalink = dialog.get_permalink_from_field() self.generate_seed_tab.generate_seed_from_permalink(permalink)