Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions splatplost/gui/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
9 changes: 8 additions & 1 deletion splatplost/gui/plotter.ui
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="save_and_exit">
<property name="text">
<string>Save and Exit on Completion</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
Expand Down Expand Up @@ -425,7 +432,7 @@
<x>0</x>
<y>0</y>
<width>658</width>
<height>34</height>
<height>22</height>
</rect>
</property>
<property name="defaultUp">
Expand Down
15 changes: 15 additions & 0 deletions splatplost/keybindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
12 changes: 10 additions & 2 deletions splatplost/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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
Expand All @@ -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.

Expand All @@ -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)
Expand All @@ -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,
Expand Down