diff --git a/splatplost/gui/plotter.py b/splatplost/gui/plotter.py
index 45539b4..7731fb4 100644
--- a/splatplost/gui/plotter.py
+++ b/splatplost/gui/plotter.py
@@ -267,7 +267,8 @@ def draw_func():
cursor_reset_time=1000 * int(self.cal_time.value()),
stable_mode=self.stable_mode.isChecked(),
clear_drawing=self.clear_drawing.isChecked(),
- plot_blocks=self.RouteFile.get_selected_blocks()
+ plot_blocks=self.RouteFile.get_selected_blocks(),
+ save_and_exit=self.save_and_exit.isChecked()
)
worker = AsyncWorker(self, draw_func)
@@ -305,7 +306,8 @@ def draw_func():
cursor_reset_time=1000 * int(self.cal_time.value()),
stable_mode=self.stable_mode.isChecked(),
clear_drawing=self.clear_drawing.isChecked(),
- plot_blocks=self.RouteFile.get_selected_blocks()
+ plot_blocks=self.RouteFile.get_selected_blocks(),
+ save_and_exit=self.save_and_exit.isChecked()
)
worker = AsyncWorker(self, draw_func)
diff --git a/splatplost/gui/plotter.ui b/splatplost/gui/plotter.ui
index 023e3aa..0bfbd52 100644
--- a/splatplost/gui/plotter.ui
+++ b/splatplost/gui/plotter.ui
@@ -391,6 +391,13 @@
+ -
+
+
+ Save and Exit on Completion
+
+
+
-
@@ -425,7 +432,7 @@
0
0
658
- 34
+ 22
diff --git a/splatplost/keybindings.py b/splatplost/keybindings.py
index a4d1008..c9b44a9 100644
--- a/splatplost/keybindings.py
+++ b/splatplost/keybindings.py
@@ -18,6 +18,11 @@ def draw(self, brush_size: BrushSize) -> CommandList:
def erase(self, brush_size: BrushSize) -> CommandList:
pass
+ @staticmethod
+ @abstractmethod
+ def save() -> CommandList:
+ pass
+
@staticmethod
@abstractmethod
def clear() -> CommandList:
@@ -60,6 +65,11 @@ def erase(self, brush_size: BrushSize) -> CommandList:
commands += [Button.A]
return commands
+ @staticmethod
+ @abstractmethod
+ def save() -> CommandList:
+ return [Button.B]
+
@staticmethod
@abstractmethod
def clear() -> CommandList:
@@ -97,6 +107,11 @@ def erase(self, brush_size: BrushSize) -> CommandList:
commands += [Button.B]
return commands
+ @staticmethod
+ @abstractmethod
+ def save() -> CommandList:
+ return [Button.MINUS]
+
@staticmethod
@abstractmethod
def clear() -> CommandList:
diff --git a/splatplost/plot.py b/splatplost/plot.py
index 114d4f4..37b7c35 100755
--- a/splatplost/plot.py
+++ b/splatplost/plot.py
@@ -256,7 +256,7 @@ def partial_erase(order_file: str, backend: Type[NXWrapper], delay_ms: int = 100
def partial_erase_with_conn(connection: NXWrapper, key_binding: KeyBinding, horizontal_divider: int,
vertical_divider: int, cursor_reset, cursor_reset_time, stable_mode: bool = False,
- clear_drawing: bool = False, plot_blocks: list[int] = None) -> None:
+ clear_drawing: bool = False, plot_blocks: list[int] = None, save_and_exit: bool = False) -> None:
"""
Clean blocks.
@@ -269,6 +269,7 @@ def partial_erase_with_conn(connection: NXWrapper, key_binding: KeyBinding, hori
:param stable_mode: Whether to use stable mode.
:param clear_drawing: Whether to clear the plot before plotting.
:param plot_blocks: The blocks to plot.
+ :param save_and_exit: Whether to save an exit after completing plotting.
"""
# Goto (0,0) point
@@ -291,10 +292,13 @@ def partial_erase_with_conn(connection: NXWrapper, key_binding: KeyBinding, hori
)
execute_command_list(command_list, connection, stable_mode=stable_mode)
+ if save_and_exit:
+ execute_command_list(key_binding.save(), connection, stable_mode=stable_mode)
+
def partial_plot_with_conn(connection: NXWrapper, blocks, key_binding: KeyBinding, cursor_reset, cursor_reset_time,
stable_mode: bool = False, clear_drawing: bool = False,
- plot_blocks: list[int] = None) -> None:
+ plot_blocks: list[int] = None, save_and_exit: bool = False) -> None:
"""
Plot blocks.
@@ -306,6 +310,7 @@ def partial_plot_with_conn(connection: NXWrapper, blocks, key_binding: KeyBindin
:param stable_mode: Whether to use stable mode.
:param clear_drawing: Whether to clear the plot before plotting.
:param plot_blocks: The blocks to plot.
+ :param save_and_exit: Whether to save an exit after completing plotting.
"""
# Goto (0,0) point
command_list, current_position = reset_cursor_position((0, 0), (0, 0), cursor_reset_time)
@@ -327,6 +332,9 @@ def partial_plot_with_conn(connection: NXWrapper, blocks, key_binding: KeyBindin
)
execute_command_list(command_list, connection, stable_mode=stable_mode)
+ if save_and_exit:
+ execute_command_list(key_binding.save(), connection, stable_mode=stable_mode)
+
def partial_plot(order_file: str, backend: Type[NXWrapper], delay_ms: int = 100, press_duration_ms: int = 100,
stable_mode: bool = False, clear_drawing: bool = False, splatoon3: bool = False,