def __init__( self, parent: wx.Window, canvas: "EditCanvas", world: "World", options_path: str ): SimpleScrollablePanel.__init__(self, parent) OperationUI.__init__(self, parent, canvas, world, options_path) self.Freeze() options = self._load_options({}) self._block_click_registered = 0 self._original_block = BlockDefine( self, world.world_wrapper.translation_manager, wx.VERTICAL, *( options.get("original_block_options", []) or [world.world_wrapper.platform] ), wildcard_properties=True, show_pick_block=True ) self._sizer.Add(self._original_block, 1, wx.ALL | wx.ALIGN_CENTRE_HORIZONTAL, 5) self._original_block.Bind( EVT_PICK, lambda evt: self._on_pick_block_button(evt, 1) ) self._replacement_block = BlockDefine( self, world.world_wrapper.translation_manager, wx.VERTICAL, *( options.get("replacement_block_options", []) or [world.world_wrapper.platform] ), show_pick_block=True ) self._sizer.Add( self._replacement_block, 1, wx.ALL | wx.ALIGN_CENTRE_HORIZONTAL, 5 ) self._replacement_block.Bind( EVT_PICK, lambda evt: self._on_pick_block_button(evt, 2) ) self._run_button = wx.Button(self, label="Run Operation") self._run_button.Bind(wx.EVT_BUTTON, self._run_operation) self._sizer.Add(self._run_button, 0, wx.ALL | wx.ALIGN_CENTRE_HORIZONTAL, 5) self.Layout() self.Thaw()
def __init__( self, parent: wx.Window, canvas: "EditCanvas", world: "BaseLevel", options_path: str, ): wx.Panel.__init__(self, parent) OperationUI.__init__(self, parent, canvas, world, options_path) self._sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(self._sizer) options = self._load_options({}) self._description = wx.TextCtrl(self, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_BESTWRAP) self._sizer.Add(self._description, 0, wx.ALL | wx.EXPAND, 5) self._description.SetLabel( "ペイントツールのバケツのように、選択したマスを起点として空洞を指定したブロックで埋めます。") self._description.Fit() self._find_size_label = wx.StaticText(self, wx.ID_ANY, "最大空洞探査ブロック数\n" + "※0指定で制限なし") self._sizer.Add(self._find_size_label, 0, wx.LEFT | wx.RIGHT, 5) self._find_size = wx.SpinCtrl(self, style=wx.SP_ARROW_KEYS, min=0, max=2000000000, initial=0) default_value = options.get('find_size') if default_value is not None: self._find_size.SetValue(int(default_value)) self._sizer.Add(self._find_size, 0, wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, 5) self._block_define_label = wx.StaticText(self, wx.ID_ANY, "空洞を埋めるブロック") self._sizer.Add(self._block_define_label, 0, wx.LEFT | wx.RIGHT, 5) self._block_define = BlockDefine( self, world.translation_manager, wx.VERTICAL, *(options.get("fill_block_options", []) or [world.level_wrapper.platform]), show_pick_block=True) self._block_click_registered = False self._block_define.Bind(EVT_PICK, self._on_pick_block_button) self._sizer.Add( self._block_define, 1, wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.ALIGN_CENTRE_HORIZONTAL, 5) self._run_button = wx.Button(self, label="実行") self._run_button.Bind(wx.EVT_BUTTON, self._run_operation) self._sizer.Add(self._run_button, 0, wx.ALL | wx.ALIGN_CENTRE_HORIZONTAL, 5) self.Layout()
def __init__(self, parent: wx.Window, canvas: "EditCanvas", world: "World", options_path: str): wx.Panel.__init__(self, parent) OperationUI.__init__(self, parent, canvas, world, options_path) self._sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(self._sizer) options = self._load_options({}) self._block_define = BlockDefine( self, world.translation_manager, wx.VERTICAL, *(options.get("fill_block_options", []) or [world.world_wrapper.platform]), show_pick_block=True) self._block_click_registered = False self._block_define.Bind(EVT_PICK, self._on_pick_block_button) self._sizer.Add(self._block_define, 1, wx.ALL | wx.ALIGN_CENTRE_HORIZONTAL, 5) self._run_button = wx.Button(self, label="Run Operation") self._run_button.Bind(wx.EVT_BUTTON, self._run_operation) self._sizer.Add(self._run_button, 0, wx.ALL | wx.ALIGN_CENTRE_HORIZONTAL, 5) self.Layout()
def __init__(self, parent: MultiBlockDefine, translation_manager, collapsed=False): super().__init__(parent, style=wx.BORDER_SIMPLE) self.EXPAND = MAXIMIZE.bitmap(18, 18) self.COLLAPSE = MINIMIZE.bitmap(18, 18) self._collapsed = collapsed sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(sizer) header_sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(header_sizer, 0, wx.ALL, 5) self.expand_button = wx.BitmapButton(self, bitmap=self.EXPAND) header_sizer.Add(self.expand_button, 0, 5) self.up_button = wx.BitmapButton(self, bitmap=UP_CARET.bitmap(18, 18)) header_sizer.Add(self.up_button, 0, wx.LEFT, 5) self.up_button.Bind(wx.EVT_BUTTON, lambda evt: parent.move_up(self)) self.down_button = wx.BitmapButton(self, bitmap=DOWN_CARET.bitmap(18, 18)) header_sizer.Add(self.down_button, 0, wx.LEFT, 5) self.down_button.Bind(wx.EVT_BUTTON, lambda evt: parent.move_down(self)) self.delete_button = wx.BitmapButton(self, bitmap=TRASH.bitmap(18, 18)) header_sizer.Add(self.delete_button, 0, wx.LEFT, 5) self.delete_button.Bind(wx.EVT_BUTTON, lambda evt: parent.delete(self)) self.block_define = BlockDefine(self, translation_manager, wx.HORIZONTAL) sizer.Add(self.block_define, 1, wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, 5) self.collapsed = collapsed self.block_label = wx.StaticText( self, label=self._gen_block_string(), style=wx.ST_ELLIPSIZE_END | wx.ST_NO_AUTORESIZE, size=(500, -1), ) header_sizer.Add(self.block_label, 1, wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 5) self.expand_button.Bind(wx.EVT_BUTTON, lambda evt: self._toggle_block_expand(parent)) self.block_define.Bind(EVT_PROPERTIES_CHANGE, self._on_properties_change)
def __init__( self, parent: wx.Window, canvas: "EditCanvas", world: "BaseLevel", options_path: str, ): wx.Panel.__init__(self, parent) DefaultOperationUI.__init__(self, parent, canvas, world, options_path) self.Freeze() self._sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(self._sizer) options = self._load_options({}) top_sizer = wx.BoxSizer(wx.HORIZONTAL) self._sizer.Add(top_sizer, 0, wx.EXPAND | wx.ALL, 5) help_button = wx.BitmapButton( self, bitmap=image.icon.tablericons.help.bitmap(22, 22)) top_sizer.Add(help_button) def on_button(evt): dialog = SimpleDialog(self, "Extra block help.") text = wx.TextCtrl( dialog, value= "Blocks in the newer versions of Minecraft support having two blocks in the same location.\n" "This is how the game is able to have water and blocks like fences at the same location.\n" "In the example of waterlogged fences the fence is the first block and the water is the second. Unless it is water the second block is usually just visual.\n" "In Java currently the second block is strictly water but in Bedrock there is no limit on what the second block can be.\n" "It is not possible to set non-water second blocks in the game but this operation enables the use of that feature.\n" "There are a number of different modes which can be selected at the top. A description of how it works will appear.", style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_BESTWRAP, ) dialog.sizer.Add(text, 1, wx.EXPAND) dialog.ShowModal() evt.Skip() help_button.Bind(wx.EVT_BUTTON, on_button) self._mode = wx.Choice(self, choices=list(MODES.keys())) self._mode.SetSelection(0) top_sizer.Add(self._mode, 1, wx.EXPAND | wx.LEFT, 5) self._mode.Bind(wx.EVT_CHOICE, self._on_mode_change) self._mode_description = wx.TextCtrl(self, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_BESTWRAP) self._sizer.Add(self._mode_description, 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 5) self._mode_description.SetLabel(MODES[self._mode.GetString( self._mode.GetSelection())]) self._mode_description.Fit() self._block_define = BlockDefine( self, world.level_wrapper.translation_manager, wx.VERTICAL, *(options.get("fill_block_options", []) or [world.level_wrapper.platform]), show_pick_block=True) self._block_define.Bind(EVT_PICK, self._on_pick_block_button) self._sizer.Add(self._block_define, 1, wx.ALL | wx.ALIGN_CENTRE_HORIZONTAL, 5) self._run_button = wx.Button(self, label="Run Operation") self._run_button.Bind(wx.EVT_BUTTON, self._run_operation) self._sizer.Add(self._run_button, 0, wx.ALL | wx.ALIGN_CENTRE_HORIZONTAL, 5) self.Layout() self.Thaw()