Exemplo n.º 1
0
def show_ui(parent, world: "World", options: dict) -> dict:
    dialog = SimpleDialog(parent, 'Replace')
    horizontal_panel = SimplePanel(dialog.custom_panel, wx.HORIZONTAL)
    dialog.custom_panel.add_object(horizontal_panel)

    original_block = BlockDefine(horizontal_panel,
                                 world.world_wrapper.translation_manager,
                                 options.get("original_block_options"),
                                 wildcard=True)
    replacement_block = BlockDefine(horizontal_panel,
                                    world.world_wrapper.translation_manager,
                                    options.get("replacement_block_options"))
    horizontal_panel.add_object(original_block, 0)
    horizontal_panel.add_object(replacement_block, 0)
    dialog.Fit()

    if dialog.ShowModal() == wx.ID_OK:
        options = {
            "original_block_options":
            original_block.options,
            "replacement_block":
            world.translation_manager.get_version(
                replacement_block.platform,
                replacement_block.version).block.to_universal(
                    replacement_block.block,
                    force_blockstate=replacement_block.force_blockstate)[0],
            "replacement_block_options":
            original_block.options,
        }
    return options
Exemplo n.º 2
0
def show_ui(parent, world: "World", options: dict) -> dict:
    dialog = SimpleDialog(parent, 'Replace', wx.HORIZONTAL)

    original_block = BlockDefine(dialog,
                                 world.world_wrapper.translation_manager,
                                 *(options.get("original_block_options", [])
                                   or [world.world_wrapper.platform]),
                                 wildcard=True)
    replacement_block = BlockDefine(
        dialog, world.world_wrapper.translation_manager,
        *(options.get("replacement_block_options", [])
          or [world.world_wrapper.platform]))
    dialog.sizer.Add(original_block, 0)
    dialog.sizer.Add(replacement_block, 0)
    dialog.Fit()

    if dialog.ShowModal() == wx.ID_OK:
        options = {
            "original_block_options":
            original_block.options,
            "replacement_block":
            world.translation_manager.get_version(
                replacement_block.platform,
                replacement_block.version).block.to_universal(
                    replacement_block.block,
                    force_blockstate=replacement_block.force_blockstate)[0],
            "replacement_block_options":
            replacement_block.options,
        }
    return options
Exemplo n.º 3
0
 def __init__(self, container, world: World):
     super(ConvertExtension, self).__init__(
         container
     )
     self.world = world
     self._version_select = BlockDefine(self, world.world_wrapper.translation_manager)
     self.add_object(self._version_select, 0, wx.EXPAND)
Exemplo n.º 4
0
def show_ui(parent, world: "World", options: dict) -> dict:
    dialog = SimpleDialog(parent, 'Fill')
    block_define = BlockDefine(dialog.custom_panel,
                               world.world_wrapper.translation_manager,
                               *options.get("fill_block_options", []))
    dialog.custom_panel.add_object(block_define)
    dialog.Fit()
    if dialog.ShowModal() == wx.ID_OK:
        options = {
            "fill_block":
            world.world_wrapper.translation_manager.get_version(
                block_define.platform,
                block_define.version).block.to_universal(
                    block_define.block,
                    force_blockstate=block_define.force_blockstate)[0],
            "fill_block_options":
            block_define.options
        }
    return options