Skip to content

Commit

Permalink
Formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
jaythebusinessgoose authored and gmjosack committed Dec 18, 2023
1 parent 920a7e9 commit 82f2d52
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/modlunky2/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ def level_sequence(cls):
def vanilla(cls):
return cls("Vanilla setroom [warning]", "setroom{y}-{x}", False)


@serialize(rename_all="kebabcase")
@deserialize(rename_all="kebabcase")
@dataclass
Expand Down
4 changes: 2 additions & 2 deletions src/modlunky2/ui/levels/shared/multi_canvas_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ def update_scroll_region(self):
self.scrollable_canvas.update_idletasks()
self.scrollable_canvas.config(scrollregion=self.scrollable_frame.bbox("all"))

self.scrollable_canvas.xview_moveto(.5)
self.scrollable_canvas.yview_moveto(.2)
self.scrollable_canvas.xview_moveto(0.5)
self.scrollable_canvas.yview_moveto(0.2)

def _on_mousewheel(self, event, hbar, vbar, canvas):
scroll_dir = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,13 @@ def get_template_draw_item_named(template_name):
mappy.append(
RoomMap(
segment.name,
[[get_template_draw_item_named(template_name) for template_name in row] for row in segment.templates]
[
[
get_template_draw_item_named(template_name)
for template_name in row
]
for row in segment.templates
],
)
)
return mappy
Expand Down
23 changes: 16 additions & 7 deletions src/modlunky2/ui/levels/vanilla_levels/multi_room/options_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,12 +622,13 @@ def update_grid_size(_):
settings_row += 1

self.layout_frame = tk.Frame(self.scrollview.scrollable_frame)
self.layout_frame.grid(row=settings_row, column=0, sticky="news", padx=10, pady=10)
self.layout_frame.grid(
row=settings_row, column=0, sticky="news", padx=10, pady=10
)

self.layout_label = tk.Label(self.layout_frame, text="Layout:")
self.layout_label.grid(row=0, column=0, sticky="w")


self.layout_combobox = ttk.Combobox(self.layout_frame, height=25)
self.layout_combobox.grid(row=0, column=1, sticky="nsw", padx=(0, 10))
self.layout_combobox["values"] = ["Default"]
Expand All @@ -640,7 +641,9 @@ def update_grid_size(_):
self.layout_combobox.grid_remove()
self.layout_label.grid_remove()

self.save_layout_button = tk.Button(self.layout_frame, text="Save layout", command=self.save_room_map)
self.save_layout_button = tk.Button(
self.layout_frame, text="Save layout", command=self.save_room_map
)
self.save_layout_button.grid(row=0, column=2, sticky="w")
self.save_layout_button.grid_remove()
self.layout_frame.grid_remove()
Expand Down Expand Up @@ -681,7 +684,6 @@ def update_grid_size(_):
self.room_options.grid(row=settings_row, column=0, sticky="news")
self.room_options.grid_remove()


def save_room_map(self):
win = PopupWindow("Save Layout", self.modlunky_config)

Expand All @@ -700,7 +702,10 @@ def save_and_destroy():
for template_map in self.room_map:
segment = CustomRoomMapSegment(
template_map.name,
[[room.template.name if room else "" for room in row] for row in template_map.rooms]
[
[room.template.name if room else "" for room in row]
for row in template_map.rooms
],
)
segments.append(segment)
room_map = CustomRoomMap(col1_ent.get(), segments)
Expand All @@ -709,7 +714,9 @@ def save_and_destroy():
level_room_maps = []
level_room_maps.append(room_map)
self.modlunky_config.custom_room_maps[self.lvl] = level_room_maps
self.modlunky_config.default_custom_room_maps[self.lvl] = len(level_room_maps) - 1
self.modlunky_config.default_custom_room_maps[self.lvl] = (
len(level_room_maps) - 1
)
self.modlunky_config.save()
self.update_layouts()

Expand Down Expand Up @@ -763,7 +770,9 @@ def update_layouts(self):
self.layout_combobox.grid()
self.layout_label.grid()
self.layout_frame.grid()
self.layout_combobox["values"] = ["Default"] + [map.name for map in level_room_maps]
self.layout_combobox["values"] = ["Default"] + [
map.name for map in level_room_maps
]
default_layout = self.modlunky_config.default_custom_room_maps.get(self.lvl)
layout_index = default_layout + 1 if default_layout is not None else 0
self.layout_combobox.current(layout_index)
Expand Down

0 comments on commit 82f2d52

Please sign in to comment.