summaryrefslogtreecommitdiff
path: root/toolkit/gocui/main.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-04-26 20:56:25 -0500
committerJeff Carr <[email protected]>2023-04-26 20:56:25 -0500
commite3cf42f1da9ec0ed07a7f346a0ce9c9ff10295c1 (patch)
tree0fe6fe28f11ccb3d1d6a989349071928f4a7ccb9 /toolkit/gocui/main.go
parent5b217fa23af4e5040d5f09d9840ddc426a315960 (diff)
gocui: log() output works
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/gocui/main.go')
-rw-r--r--toolkit/gocui/main.go26
1 files changed, 23 insertions, 3 deletions
diff --git a/toolkit/gocui/main.go b/toolkit/gocui/main.go
index 492d935..4b66153 100644
--- a/toolkit/gocui/main.go
+++ b/toolkit/gocui/main.go
@@ -35,6 +35,12 @@ func PluginChannel() chan toolkit.Action {
return me.pluginChan
}
+/*
+recieves requests from the program to do things like:
+* add new widgets
+* change the text of a label
+* etc..
+*/
func catchActionChannel() {
log(logInfo, "catchActionChannel() START")
for {
@@ -55,21 +61,35 @@ func catchActionChannel() {
func Exit() {
// TODO: what should actually happen here?
me.baseGui.Close()
+ sendBackQuit()
}
+func sendBackQuit() {
+ // send 'Quit' back to the program (?)
+ var a toolkit.Action
+ a.ActionType = toolkit.UserQuit
+ me.callback <- a
+}
+
+var outf *os.File
+
func main() {
+ var err error
log(logInfo, "main() start Init()")
- outf, err := os.OpenFile("/tmp/witgui.log", os.O_RDWR | os.O_CREATE | os.O_APPEND, 0666)
+ outf, err = os.OpenFile("/tmp/witgui.log", os.O_RDWR | os.O_CREATE | os.O_APPEND, 0666)
if err != nil {
exit("error opening file: %v", err)
}
defer outf.Close()
- setOutput(outf)
- log("This is a test log entry")
+ // setOutput(outf)
+ // log("This is a test log entry")
MouseMain()
+
log(true, "MouseMain() closed")
me.baseGui.Close()
+
+ sendBackQuit()
}