diff --git a/src/gameeky/editor/scene.py b/src/gameeky/editor/scene.py index fbd1486f..091e861b 100644 --- a/src/gameeky/editor/scene.py +++ b/src/gameeky/editor/scene.py @@ -49,6 +49,7 @@ find_project_path, bytearray_to_string, launch_path, + launch_player, ) @@ -199,6 +200,21 @@ def _do_save(self, path) -> None: self._scene_path = path self._pending_changes = False + def __on_try(self, action: Gio.SimpleAction, data: Optional[Any] = None) -> None: + if self._scene_path is None: + self.__on_save_as() + else: + self._do_save(self._scene_path) + self._try_scene() + + def _try_scene(self) -> None: + if self._project_path is None: + return + if self._scene_path is None: + return + + launch_player(self._project_path, self._scene_path) + def __on_about(self, action: Gio.SimpleAction, data: Optional[Any] = None) -> None: present_about(self._window) @@ -287,6 +303,10 @@ def do_startup(self) -> None: save_as_action.connect("activate", self.__on_save_as) self.add_action(save_as_action) + try_action = Gio.SimpleAction.new("try", None) + try_action.connect("activate", self.__on_try) + self.add_action(try_action) + browse_action = Gio.SimpleAction.new("browse", None) browse_action.connect("activate", self.__on_browse) self.add_action(browse_action) diff --git a/src/gameeky/editor/widgets/scene_window.ui b/src/gameeky/editor/widgets/scene_window.ui index 5c1f36a9..d0564c8d 100644 --- a/src/gameeky/editor/widgets/scene_window.ui +++ b/src/gameeky/editor/widgets/scene_window.ui @@ -304,6 +304,10 @@ app.save_as Save _As… + + app.try + _Try It + app.edit _Settings