@@ -2,6 +2,8 @@ package main
2
2
3
3
import (
4
4
"net/url"
5
+ "os"
6
+ "os/exec"
5
7
"strings"
6
8
7
9
"github.com/fyne-io/defyne/internal/envcheck"
@@ -59,6 +61,14 @@ func (d *defyne) menuActionNew() {
59
61
}, d .win )
60
62
}
61
63
64
+ func (d * defyne ) menuActionRunProject () {
65
+ cmd := exec .Command ("go" , "run" , "." )
66
+ cmd .Dir = d .projectRoot .Path ()
67
+ cmd .Stderr = os .Stderr
68
+ cmd .Stdout = os .Stdout
69
+ cmd .Start ()
70
+ }
71
+
62
72
func (d * defyne ) menuActionRun () {
63
73
if ed , ok := d .openEditors [d .fileTabs .Selected ()]; ok {
64
74
ed .run ()
@@ -79,7 +89,9 @@ func (d *defyne) makeMenu() *fyne.MainMenu {
79
89
fyne .NewMenuItem ("New File..." , d .menuActionNew ),
80
90
fyne .NewMenuItemSeparator (),
81
91
fyne .NewMenuItem ("Save" , d .menuActionSave ),
92
+ fyne .NewMenuItemSeparator (),
82
93
fyne .NewMenuItem ("Run" , d .menuActionRun ),
94
+ fyne .NewMenuItem ("Run Project" , d .menuActionRunProject ),
83
95
),
84
96
fyne .NewMenu ("Help" ,
85
97
fyne .NewMenuItem ("Documentation" , func () {
@@ -107,5 +119,7 @@ func (d *defyne) makeToolbar() *widget.Toolbar {
107
119
return widget .NewToolbar (
108
120
widget .NewToolbarAction (theme .FileIcon (), d .menuActionNew ),
109
121
widget .NewToolbarAction (theme .DocumentSaveIcon (), d .menuActionSave ),
110
- widget .NewToolbarAction (theme .MailForwardIcon (), d .menuActionRun ))
122
+ widget .NewToolbarSeparator (),
123
+ widget .NewToolbarAction (theme .MediaPlayIcon (), d .menuActionRun ),
124
+ widget .NewToolbarAction (theme .NewThemedResource (resourceFolderPlaySvg ), d .menuActionRunProject ))
111
125
}
0 commit comments