Skip to content

Commit

Permalink
Add some padding to the randomize buttons.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaythebusinessgoose authored and gmjosack committed Dec 21, 2023
1 parent 511d7d2 commit 70920fb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def image_for_tile_code(self, tile_code):
self.tile_image_map[tile_name] = new_tile_image
return new_tile_image

def use_roommap_at(self, index, fresh = False):
def use_roommap_at(self, index, fresh=False):
if self.lvl is None:
return

Expand Down Expand Up @@ -247,7 +247,9 @@ def open_lvl(self, lvl, biome, tile_palette_map, room_templates):
self.default_draw_map = find_roommap(room_templates)
# self.template_draw_map = find_roommap(room_templates)

self.use_roommap_at(self.modlunky_config.default_custom_room_maps.get(self.lvl), True)
self.use_roommap_at(
self.modlunky_config.default_custom_room_maps.get(self.lvl), True
)

def redraw(self):
self.canvas.clear()
Expand Down Expand Up @@ -522,7 +524,6 @@ def select_random_room_at(mi, r, c):
if template_item is None:
return


valid_rooms = [
index
for index, room in enumerate(template_item.template.rooms)
Expand All @@ -547,8 +548,6 @@ def select_random_room_at(mi, r, c):
else:
select_random_room_at(map_index, row, col)



self.options_panel.set_templates(self.template_draw_map, self.room_templates)
self.redraw()

Expand Down
20 changes: 15 additions & 5 deletions src/modlunky2/ui/levels/vanilla_levels/multi_room/options_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,19 @@ def __init__(
self.room_combobox["state"] = "readonly"
self.room_combobox.bind("<<ComboboxSelected>>", lambda _: self.select_room())

randomize_room_button = ttk.Button(room_combo_container, text="Random", command=self.random_room)
randomize_room_button.grid(row=0, column=1, sticky="w")
randomize_room_button = ttk.Button(
room_combo_container, text="Random", command=self.random_room
)
randomize_room_button.grid(row=0, column=1, sticky="w", padx=10)

template_setting_row += 1

randomize_all_button = ttk.Button(self.template_container, text="Randomize All", command=self.randomize_all)
randomize_all_button.grid(row=template_setting_row, column=0, sticky="w")
randomize_all_button = ttk.Button(
self.template_container, text="Randomize All", command=self.randomize_all
)
randomize_all_button.grid(
row=template_setting_row, column=0, sticky="w", pady=10
)

template_setting_row += 1

Expand Down Expand Up @@ -352,7 +358,11 @@ def select_room(self):
)

def random_room(self):
self.on_select_random_room(self.current_template_map_index, self.current_template_row, self.current_template_column)
self.on_select_random_room(
self.current_template_map_index,
self.current_template_row,
self.current_template_column,
)

def randomize_all(self):
self.on_select_random_room()
Expand Down

0 comments on commit 70920fb

Please sign in to comment.