Skip to content

Commit

Permalink
editor: Migrate to launch_entity
Browse files Browse the repository at this point in the history
  • Loading branch information
tchx84 committed Feb 28, 2024
1 parent 8d57327 commit a98c8d8
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions src/gameeky/editor/widgets/scene_entity_popover.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

from .entity_row import EntityRow

from ...common.utils import launch, quote, get_project_path
from ...common.utils import launch_entity, get_project_path


class Operation(StrEnum):
Expand Down Expand Up @@ -55,18 +55,6 @@ def _update_buttons(self, entity: Optional[EntityRow]) -> None:
self.edit.props.sensitive = sensitive
self.delete.props.sensitive = sensitive

def _launch_editor(self, path="") -> None:
command = "dev.tchx84.Gameeky.Entity"
argument = f"--project_path={quote(get_project_path())} {quote(path)}".strip()

launch(command, argument)

def _launch_editor_with_path(self) -> None:
if self._entity is None:
return

self._launch_editor(self._entity.model.path)

def _emit_deleted(self) -> None:
if self._entity is None:
return
Expand All @@ -78,9 +66,9 @@ def __on_activated(self, box: Gtk.ListBox, row: Gtk.ListBoxRow) -> None:
operation = row.props.name

if operation == Operation.ADD:
self._launch_editor()
elif operation == Operation.EDIT:
self._launch_editor_with_path()
launch_entity(get_project_path(), "")
elif operation == Operation.EDIT and self._entity is not None:
launch_entity(get_project_path(), self._entity.model.path)
elif operation == Operation.DELETE:
self._emit_deleted()

Expand Down

0 comments on commit a98c8d8

Please sign in to comment.