File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ export interface PyWebview {
1111 load_project_id : ( ) => Promise < string | null > ;
1212 backup_project : ( content : string ) => Promise < boolean > ;
1313 restore_project : ( ) => Promise < string > ;
14+ run_project : ( ) => Promise < void > ;
1415 }
1516}
1617
Original file line number Diff line number Diff line change @@ -111,6 +111,12 @@ const setupDesktopTools = () => {
111111 return getApi ( ) ! . restore_project ( ) ;
112112 }
113113
114+ const runProject = async ( ) : Promise < void > => {
115+ if ( ! isDesktop ( ) ) return ;
116+ await waitForPWV ( ) ;
117+ return getApi ( ) ! . run_project ( ) ;
118+ }
119+
114120 return {
115121 isDesktop,
116122 closeWindow,
@@ -119,7 +125,8 @@ const setupDesktopTools = () => {
119125 loadFile,
120126 loadProjectId,
121127 backupProject,
122- getRestoredProject
128+ getRestoredProject,
129+ runProject,
123130 }
124131} ;
125132
@@ -132,5 +139,6 @@ export const {
132139 loadProjectId,
133140 backupProject,
134141 getRestoredProject,
142+ runProject,
135143} = setupDesktopTools ( ) ;
136144
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import type { RefObject } from "react";
33import type { NodeSystem , Variable } from "@defs/Node" ;
44import type { Suggestion } from "@defs/UI" ;
55
6- import { loadProjectId } from "@utils/desktopTools" ;
6+ import { isDesktop , loadProjectId , runProject } from "@utils/desktopTools" ;
77import { loadData , wipeData } from "@utils/persistentTools" ;
88import { generateId } from "@utils/generatorTools" ;
99import { downloadScript } from "@utils/compilerTools" ;
@@ -85,6 +85,13 @@ const setupProjectTools = () => {
8585 icon : "Rocket" ,
8686 action : ( ) => downloadScript ( nodeSystem , entries ) ,
8787 } ,
88+ ...( isDesktop ( ) ? [
89+ {
90+ name : "Run Project" ,
91+ icon : "CirclePlay" ,
92+ action : ( ) => runProject ( ) ,
93+ }
94+ ] : [ ] ) ,
8895 ] ;
8996 } ;
9097
You can’t perform that action at this time.
0 commit comments