This is subotimal, must take the comments into consideration
This commit is contained in:
@@ -22,21 +22,25 @@ func (wc *WindowingController) CreateWindow(x, y,
|
||||
wc.Ctx.Log("title : %s\n", title)
|
||||
// newWindow := tview.NewTreeNode(title)
|
||||
|
||||
xValue, err := strconv.ParseInt(x, 10, 1)
|
||||
xValue, err := strconv.ParseUint(x, 10, 64)
|
||||
if err != nil {
|
||||
// return err
|
||||
wc.Events.Emit(events.Error{Error: err})
|
||||
return
|
||||
}
|
||||
yValue, err := strconv.ParseInt(y, 10, 1)
|
||||
yValue, err := strconv.ParseUint(y, 10, 64)
|
||||
if err != nil {
|
||||
// return err
|
||||
wc.Events.Emit(events.Error{Error: err})
|
||||
return
|
||||
}
|
||||
widthValue, err := strconv.ParseInt(width, 10, 1)
|
||||
widthValue, err := strconv.ParseUint(width, 10, 64)
|
||||
if err != nil {
|
||||
// return err
|
||||
wc.Events.Emit(events.Error{Error: err})
|
||||
return
|
||||
}
|
||||
heightValue, err := strconv.ParseInt(height, 10, 1)
|
||||
heightValue, err := strconv.ParseUint(height, 10, 64)
|
||||
if err != nil {
|
||||
// return err
|
||||
wc.Events.Emit(events.Error{Error: err})
|
||||
return
|
||||
}
|
||||
|
||||
window := models.Window{
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
package events
|
||||
|
||||
import "esdi/t/internal/models"
|
||||
import (
|
||||
"esdi/t/internal/models"
|
||||
)
|
||||
|
||||
type Error struct {
|
||||
Error error
|
||||
}
|
||||
|
||||
type WindowCreated struct {
|
||||
Window models.Window
|
||||
|
||||
@@ -19,8 +19,13 @@ func BindWindowEvents(
|
||||
bus *events.Bus,
|
||||
tree *tview.TreeView,
|
||||
) {
|
||||
// I recon I have to change this for some type os event system that
|
||||
// triggers directly on the UINodes I want them to be triggered on
|
||||
bus.On(events.WindowCreated{}, func(e any) {
|
||||
ctx.Log("Received a window created event")
|
||||
ctx.Log("Received a window created event\n")
|
||||
})
|
||||
bus.On(events.Error{}, func(e any) {
|
||||
ctx.Log("Error performing action: %s\n", e.(events.Error).Error.Error())
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user