Skip to content

Commit

Permalink
Shortcut to create a region
Browse files Browse the repository at this point in the history
  • Loading branch information
Acly committed Jun 8, 2024
1 parent b803da8 commit 49cfcef
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ai_diffusion/ai_diffusion.action
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@
<isCheckable>false</isCheckable>
<statusTip/>
</Action>
<Action name="ai_diffusion_create_region">
<icon/>
<text>Create region</text>
<whatsThis/>
<toolTip/>
<iconText/>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip/>
</Action>
<Action name="ai_diffusion_switch_workspace_generation">
<icon/>
<text>Switch workspace: Generate</text>
Expand Down
1 change: 1 addition & 0 deletions ai_diffusion/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def createActions(self, window):
self._create_action(window, "cancel_all", actions.cancel_all)
self._create_action(window, "toggle_preview", actions.toggle_preview)
self._create_action(window, "apply", actions.apply)
self._create_action(window, "create_region", actions.create_region)
self._create_action(
window, "switch_workspace_generation", actions.set_workspace(Workspace.generation)
)
Expand Down
5 changes: 5 additions & 0 deletions ai_diffusion/ui/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ def apply():
model.apply_result(*model.jobs.selection)


def create_region():
if model := root.model_for_active_document():
model.regions.create_region(group=model.workspace is not Workspace.live)


def set_workspace(workspace: Workspace):
def action():
if model := root.model_for_active_document():
Expand Down

0 comments on commit 49cfcef

Please sign in to comment.