File tree Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ export interface PyWebview {
11
11
load_project_id : ( ) => Promise < string | null > ;
12
12
backup_project : ( content : string ) => Promise < boolean > ;
13
13
restore_project : ( ) => Promise < string > ;
14
+ run_project : ( ) => Promise < void > ;
14
15
}
15
16
}
16
17
Original file line number Diff line number Diff line change @@ -111,6 +111,12 @@ const setupDesktopTools = () => {
111
111
return getApi ( ) ! . restore_project ( ) ;
112
112
}
113
113
114
+ const runProject = async ( ) : Promise < void > => {
115
+ if ( ! isDesktop ( ) ) return ;
116
+ await waitForPWV ( ) ;
117
+ return getApi ( ) ! . run_project ( ) ;
118
+ }
119
+
114
120
return {
115
121
isDesktop,
116
122
closeWindow,
@@ -119,7 +125,8 @@ const setupDesktopTools = () => {
119
125
loadFile,
120
126
loadProjectId,
121
127
backupProject,
122
- getRestoredProject
128
+ getRestoredProject,
129
+ runProject,
123
130
}
124
131
} ;
125
132
@@ -132,5 +139,6 @@ export const {
132
139
loadProjectId,
133
140
backupProject,
134
141
getRestoredProject,
142
+ runProject,
135
143
} = setupDesktopTools ( ) ;
136
144
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import type { RefObject } from "react";
3
3
import type { NodeSystem , Variable } from "@defs/Node" ;
4
4
import type { Suggestion } from "@defs/UI" ;
5
5
6
- import { loadProjectId } from "@utils/desktopTools" ;
6
+ import { isDesktop , loadProjectId , runProject } from "@utils/desktopTools" ;
7
7
import { loadData , wipeData } from "@utils/persistentTools" ;
8
8
import { generateId } from "@utils/generatorTools" ;
9
9
import { downloadScript } from "@utils/compilerTools" ;
@@ -85,6 +85,13 @@ const setupProjectTools = () => {
85
85
icon : "Rocket" ,
86
86
action : ( ) => downloadScript ( nodeSystem , entries ) ,
87
87
} ,
88
+ ...( isDesktop ( ) ? [
89
+ {
90
+ name : "Run Project" ,
91
+ icon : "CirclePlay" ,
92
+ action : ( ) => runProject ( ) ,
93
+ }
94
+ ] : [ ] ) ,
88
95
] ;
89
96
} ;
90
97
You can’t perform that action at this time.
0 commit comments