def __init__(self, editor: PresetEditor,
                 game_description: GameDescription) -> None:
        super().__init__(editor)
        self.setupUi(self)

        # Game-specific Settings
        game_settings = self.game_specific_widgets
        if game_settings is not None:
            for w in game_settings:
                self.game_specific_layout.addWidget(w)
        else:
            self.game_specific_group.setVisible(False)

        # Item Placement
        signal_handling.on_checked(self.multi_pickup_placement_check,
                                   self._persist_multi_pickup_placement)
        signal_handling.on_checked(self.multi_pickup_new_weighting_check,
                                   self._persist_multi_pickup_new_weighting)
        signal_handling.on_checked(self.check_major_minor,
                                   self._persist_major_minor)
        signal_handling.on_checked(self.local_first_progression_check,
                                   self._persist_local_first_progression)

        # Logic Settings
        self.dangerous_combo.setItemData(0,
                                         LayoutLogicalResourceAction.RANDOMLY)
        self.dangerous_combo.setItemData(
            1, LayoutLogicalResourceAction.LAST_RESORT)
        signal_handling.on_combo(self.dangerous_combo,
                                 self._on_dangerous_changed)

        signal_handling.on_checked(self.trick_level_minimal_logic_check,
                                   self._on_trick_level_minimal_logic_check)
        for w in [
                self.trick_level_minimal_logic_check,
                self.trick_level_minimal_logic_label, self.minimal_logic_line
        ]:
            w.setVisible(game_description.minimal_logic is not None)
        if game_description.minimal_logic is not None:
            self.trick_level_minimal_logic_label.setText(
                self.trick_level_minimal_logic_label.text().format(
                    game_specific_text=game_description.minimal_logic.
                    description))

        # Damage strictness
        self.damage_strictness_combo.setItemData(0,
                                                 LayoutDamageStrictness.STRICT)
        self.damage_strictness_combo.setItemData(1,
                                                 LayoutDamageStrictness.MEDIUM)
        self.damage_strictness_combo.setItemData(
            2, LayoutDamageStrictness.LENIENT)
        self.damage_strictness_combo.currentIndexChanged.connect(
            self._on_update_damage_strictness)
    def __init__(self, editor: PresetEditor,
                 game_description: GameDescription) -> None:
        super().__init__(editor)
        self.setupUi(self)

        # Mode
        self.mode_combo.setItemData(0, DockRandoMode.VANILLA)
        self.mode_combo.setItemData(1, DockRandoMode.TWO_WAY)
        self.mode_combo.setItemData(2, DockRandoMode.ONE_WAY)
        signal_handling.on_combo(self.mode_combo, self._on_mode_changed)

        # Types
        self.type_checks = {}
        for dock_type, type_params in game_description.dock_weakness_database.dock_rando_params.items(
        ):
            if (type_params.locked is None or type_params.unlocked is None
                    or not type_params.change_from
                    or not type_params.change_to):
                continue
            self._add_dock_type(dock_type, type_params)
Beispiel #3
0
    def __init__(self, editor: PresetEditor):
        super().__init__(editor)
        self.setupUi(self)

        self.description_label.setText(self.description_label.text().replace("color:#0000ff;", ""))

        # Signals
        self.cutscene_combo.setItemData(0, LayoutCutsceneMode.ORIGINAL)
        self.cutscene_combo.setItemData(1, LayoutCutsceneMode.COMPETITIVE)
        self.cutscene_combo.setItemData(2, LayoutCutsceneMode.MINOR)
        self.cutscene_combo.setItemData(3, LayoutCutsceneMode.MAJOR)
        signal_handling.on_combo(self.cutscene_combo, self._on_cutscene_changed)
        self.room_rando_combo.setItemData(0, RoomRandoMode.NONE)
        self.room_rando_combo.setItemData(1, RoomRandoMode.ONE_WAY)
        self.room_rando_combo.setItemData(2, RoomRandoMode.TWO_WAY)
        signal_handling.on_combo(self.room_rando_combo, self._on_room_rando_changed)
        for f in _FIELDS:
            self._add_persist_option(getattr(self, f"{f}_check"), f)

        signal_handling.on_checked(self.small_samus_check, self._on_small_samus_changed)
        signal_handling.on_checked(self.large_samus_check, self._on_large_samus_changed)

        self.superheated_slider.valueChanged.connect(self._on_slider_changed)
        self.submerged_slider.valueChanged.connect(self._on_slider_changed)
Beispiel #4
0
    def __init__(self, parent: QtWidgets.QWidget, game: GameDescription):
        super().__init__(parent)
        set_default_window_icon(self)
        self.setWindowTitle("Layers")

        self.root_widget = QtWidgets.QScrollArea()
        self.root_layout = QtWidgets.QVBoxLayout(self.root_widget)
        self.root_widget.setWidgetResizable(True)
        self.setWidget(self.root_widget)

        self.contents_widget = QtWidgets.QWidget()
        self.contents_layout = QtWidgets.QVBoxLayout(self.contents_widget)
        self.root_widget.setWidget(self.contents_widget)

        self.title_label = QtWidgets.QLabel(self.contents_widget)
        self.title_label.setText("Select visible layers")
        self.contents_layout.addWidget(self.title_label)

        self.layer_checks = []
        for layer in game.layers:
            self.layer_checks.append(
                layer_check := QtWidgets.QCheckBox(self.contents_widget))
            layer_check.setText(layer)
            layer_check.setChecked(True)
            signal_handling.on_checked(layer_check,
                                       lambda it: self._notify_change())
            self.contents_layout.addWidget(layer_check)

        self.add_layer_button = QtWidgets.QPushButton(self.contents_widget)
        self.add_layer_button.setText("Add new layer")
        self.add_layer_button.setEnabled(False)
        self.add_layer_button.setToolTip("Not implemented")
        self.contents_layout.addWidget(self.add_layer_button)

        self.tricks_box = QtWidgets.QGroupBox(self.contents_widget)
        self.tricks_box.setTitle("Simplify connections with:")
        self.contents_layout.addWidget(self.tricks_box)
        self.tricks_layout = QtWidgets.QVBoxLayout(self.tricks_box)

        self.tricks = {}
        for trick in sorted(game.resource_database.trick,
                            key=lambda it: it.long_name):
            trick_layout = QtWidgets.QHBoxLayout()
            self.tricks_layout.addLayout(trick_layout)

            trick_check = QtWidgets.QCheckBox(self.tricks_box)
            trick_check.setText(trick.long_name)
            trick_layout.addWidget(trick_check)

            trick_combo = ScrollProtectedComboBox(self.tricks_box)
            trick_layout.addWidget(trick_combo)
            for trick_level in enum_lib.iterate_enum(LayoutTrickLevel):
                trick_combo.addItem(trick_level.long_name,
                                    userData=trick_level.as_number)
            signal_handling.on_combo(trick_combo,
                                     lambda it: self._notify_change())
            trick_combo.setEnabled(False)

            signal_handling.on_checked(trick_check, trick_combo.setEnabled)
            signal_handling.on_checked(trick_check,
                                       lambda it: self._notify_change())

            self.tricks[(trick, trick_check)] = trick_combo

        self.load_preset_button = QtWidgets.QPushButton(self.contents_widget)
        self.load_preset_button.setText("Configure with preset")
        self.load_preset_button.clicked.connect(self._on_load_preset_slot)
        self.contents_layout.addWidget(self.load_preset_button)

        self.vertical_spacer = QtWidgets.QSpacerItem(
            20, 30, QtWidgets.QSizePolicy.Minimum,
            QtWidgets.QSizePolicy.Expanding)
        self.contents_layout.addItem(self.vertical_spacer)