diff --git a/src/modlunky2/config.py b/src/modlunky2/config.py index 0731a4d9..bba6e803 100644 --- a/src/modlunky2/config.py +++ b/src/modlunky2/config.py @@ -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 diff --git a/src/modlunky2/ui/levels/shared/multi_canvas_container.py b/src/modlunky2/ui/levels/shared/multi_canvas_container.py index 4bdac0c5..403985ab 100644 --- a/src/modlunky2/ui/levels/shared/multi_canvas_container.py +++ b/src/modlunky2/ui/levels/shared/multi_canvas_container.py @@ -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 diff --git a/src/modlunky2/ui/levels/vanilla_levels/multi_room/multi_room_editor_tab.py b/src/modlunky2/ui/levels/vanilla_levels/multi_room/multi_room_editor_tab.py index 0f5fdb20..fba7eefe 100644 --- a/src/modlunky2/ui/levels/vanilla_levels/multi_room/multi_room_editor_tab.py +++ b/src/modlunky2/ui/levels/vanilla_levels/multi_room/multi_room_editor_tab.py @@ -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 diff --git a/src/modlunky2/ui/levels/vanilla_levels/multi_room/options_panel.py b/src/modlunky2/ui/levels/vanilla_levels/multi_room/options_panel.py index 9aa470be..f3680acd 100644 --- a/src/modlunky2/ui/levels/vanilla_levels/multi_room/options_panel.py +++ b/src/modlunky2/ui/levels/vanilla_levels/multi_room/options_panel.py @@ -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"] @@ -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() @@ -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) @@ -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) @@ -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() @@ -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)