99
1010from amulet_map_editor .api .wx .ui .base_select import EVT_PICK
1111from amulet_map_editor .api .wx .ui .block_select import BlockDefine
12- from amulet_map_editor .programs .edit .api .operations import OperationUI
13- from amulet_map_editor .programs .edit .api .events import EVT_BOX_CLICK
12+ from amulet_map_editor .programs .edit .api .operations import DefaultOperationUI
1413
1514if TYPE_CHECKING :
16- from amulet .api .level import World
15+ from amulet .api .level import BaseLevel
1716 from amulet_map_editor .programs .edit .api .canvas import EditCanvas
1817
1918
@@ -29,16 +28,19 @@ def _check_block(block: Block, original_base_name: str,
2928 return False
3029
3130
32- class FindBlock (wx .Panel , OperationUI ):
31+ class FindBlock (wx .Panel , DefaultOperationUI ):
3332 def __init__ (
34- self , parent : wx .Window , canvas : "EditCanvas" , world : "World " , options_path : str
33+ self , parent : wx .Window , canvas : "EditCanvas" , world : "BaseLevel " , options_path : str
3534 ):
3635 wx .Panel .__init__ (self , parent )
37- OperationUI .__init__ (self , parent , canvas , world , options_path )
36+ DefaultOperationUI .__init__ (self , parent , canvas , world , options_path )
3837
38+ self .Freeze ()
3939 self ._sizer = wx .BoxSizer (wx .VERTICAL )
4040 self .SetSizer (self ._sizer )
4141
42+ options = self ._load_options ({})
43+
4244 self ._description = wx .TextCtrl (
4345 self , style = wx .TE_MULTILINE | wx .TE_READONLY | wx .TE_BESTWRAP
4446 )
@@ -54,11 +56,10 @@ def __init__(
5456 self ,
5557 world .translation_manager ,
5658 wx .VERTICAL ,
57- world .world_wrapper .platform ,
59+ [ world .level_wrapper .platform ] ,
5860 wildcard_properties = True ,
5961 show_pick_block = True
6062 )
61- self ._block_click_registered = False
6263 self ._block_define .Bind (EVT_PICK , self ._on_pick_block_button )
6364 self ._sizer .Add (self ._block_define , 1 , wx .LEFT | wx .RIGHT | wx .BOTTOM | wx .ALIGN_CENTRE_HORIZONTAL , 5 )
6465
@@ -67,28 +68,16 @@ def __init__(
6768 self ._sizer .Add (self ._run_button , 0 , wx .ALL | wx .ALIGN_CENTRE_HORIZONTAL , 5 )
6869
6970 self .Layout ()
71+ self .Thaw ()
7072
7173 @property
7274 def wx_add_options (self ) -> Tuple [int , ...]:
7375 return (1 ,)
7476
7577 def _on_pick_block_button (self , evt ):
76- """Set up listening for the block click"""
77- if not self ._block_click_registered :
78- self .canvas .Bind (EVT_BOX_CLICK , self ._on_pick_block )
79- self ._block_click_registered = True
80- evt .Skip ()
81-
82- def _on_pick_block (self , evt ):
83- self .canvas .Unbind (EVT_BOX_CLICK , handler = self ._on_pick_block )
84- self ._block_click_registered = False
85- x , y , z = self .canvas .cursor_location
86- self ._block_define .universal_block = (
87- self .world .get_block (x , y , z , self .canvas .dimension ),
88- None ,
89- )
78+ self ._show_pointer = True
9079
91- def unload (self ):
80+ def disable (self ):
9281 print ("Unload FindBlock" )
9382
9483 def _run_operation (self , _ ):
@@ -180,6 +169,8 @@ def _find_block(self):
180169 for x , y , z , dimension in file_out_list :
181170 f .write (x + "," + y + "," + z + "," + dimension + "\n " )
182171
172+ wx .MessageBox ("検索が完了しました。\n 出力先:" + filepath , "検索完了" )
173+
183174
184175export = {
185176 "name" : "ブロック検索" , # the name of the plugin
0 commit comments