Esempio n. 1
0
func (g *Global) SelectPort(p bh.PortIf, id bh.NodeIdIf) {
	n, err := g.GetNodeById(id)
	if err != nil {
		log.Printf("Global.SelectPort error: %s\n", err)
		return
	}
	cursor := g.nodePath(n, g.fts.Cursor(n), id)
	pCursor := g.fts.CursorAt(cursor, p)
	path, _ := gtk.TreePathNewFromString(cursor.Path)
	g.ftv.TreeView().ExpandToPath(path)
	path, _ = gtk.TreePathNewFromString(pCursor.Path)
	g.ftv.TreeView().SetCursor(path, g.ftv.TreeView().GetExpanderColumn(), false)
}
Esempio n. 2
0
func (g *Global) SelectArch(obj pf.ArchIf) {
	a := obj.(pf.ArchIf)
	cursor := g.fts.Cursor(a)
	path, _ := gtk.TreePathNewFromString(cursor.Path)
	g.ftv.TreeView().ExpandToPath(path)
	g.ftv.TreeView().SetCursor(path, g.ftv.TreeView().GetExpanderColumn(), false)
}
Esempio n. 3
0
func editPaste(menu *GoAppMenu, fts *models.FilesTreeStore, jl IJobList, ftv *views.FilesTreeView, clp *gtk.Clipboard) {
	defer MenuEditPost(menu, fts, jl)
	if !clp.WaitIsTextAvailable() {
		log.Println("editPaste: Nothing on clipboard")
		return
	}
	text, err := clp.WaitForText()
	if err != nil {
		log.Println("editPaste: Failed to get data from clipboard")
		return
	}
	job, err := ParseText(text, fts)
	if err != nil {
		log.Printf("editPaste: error parsing data from clipboard: %s\n", err)
		return
	}
	state, ok := jl.Apply(job)
	if ok {
		global.win.graphViews.Sync()
		path, err := gtk.TreePathNewFromString(state.(string))
		if err != nil {
			log.Println("editPaste error: TreePathNewFromString failed:", err)
			return
		}
		ftv.TreeView().ExpandToPath(path)
		ftv.TreeView().SetCursor(path, ftv.TreeView().GetExpanderColumn(), false)
	}
}
Esempio n. 4
0
func (v *FilesTreeView) SelectId(newId string) (err error) {
	path, err := gtk.TreePathNewFromString(newId)
	if err != nil {
		return
	}
	v.TreeView().SetCursor(path, v.TreeView().GetExpanderColumn(), false)
	return
}
Esempio n. 5
0
func (g *Global) SelectProcess(obj pf.ProcessIf) {
	p := obj.(pf.ProcessIf)
	a := p.Arch()
	aCursor := g.fts.Cursor(a)
	cursor := g.fts.CursorAt(aCursor, p)
	path, _ := gtk.TreePathNewFromString(cursor.Path)
	g.ftv.TreeView().ExpandToPath(path)
	g.ftv.TreeView().SetCursor(path, g.ftv.TreeView().GetExpanderColumn(), false)
}
Esempio n. 6
0
func (g *Global) SelectChannel(obj pf.ChannelIf) {
	c := obj.(pf.ChannelIf)
	pr := c.Process()
	a := pr.Arch()
	aCursor := g.fts.Cursor(a)
	pCursor := g.fts.CursorAt(aCursor, pr)
	cursor := g.fts.CursorAt(pCursor, c)
	path, _ := gtk.TreePathNewFromString(cursor.Path)
	g.ftv.TreeView().ExpandToPath(path)
	g.ftv.TreeView().SetCursor(path, g.ftv.TreeView().GetExpanderColumn(), false)
}
Esempio n. 7
0
func (g *Global) SelectConnect(conn bh.ConnectionIf) {
	c := conn.(bh.ConnectionIf)
	p := c.From()
	n := p.Node()
	cursor := g.fts.Cursor(n)
	pCursor := g.fts.CursorAt(cursor, p)
	cCursor := g.fts.CursorAt(pCursor, c)
	path, _ := gtk.TreePathNewFromString(cCursor.Path)
	g.ftv.TreeView().ExpandToPath(path)
	g.ftv.TreeView().SetCursor(path, g.ftv.TreeView().GetExpanderColumn(), false)
}
Esempio n. 8
0
func editRedo(menu *GoAppMenu, fts *models.FilesTreeStore, jl IJobList, ftv *views.FilesTreeView) {
	defer MenuEditPost(menu, fts, jl)
	state, ok := jl.Redo()
	if ok {
		global.win.graphViews.Sync()
		path, err := gtk.TreePathNewFromString(state.(string))
		if err != nil {
			log.Println("editNew error: TreePathNewFromString failed:", err)
			return
		}
		ftv.TreeView().ExpandToPath(path)
		ftv.TreeView().SetCursor(path, ftv.TreeView().GetExpanderColumn(), false)
	}
}
Esempio n. 9
0
func editEdit(menu *GoAppMenu, fts *models.FilesTreeStore, jl IJobList, ftv *views.FilesTreeView) {
	defer MenuEditPost(menu, fts, jl)
	dialog, err := EditDialogNew(fts)
	if err != nil {
		log.Println("editEdit error: ", err)
		return
	}
	job, ok := dialog.Run(fts)
	if ok {
		state, ok := jl.Apply(job)
		if ok {
			path, err := gtk.TreePathNewFromString(state.(string))
			if err != nil {
				log.Println("editEdit error: TreePathNewFromString failed:", err)
				return
			}
			ftv.TreeView().ExpandToPath(path)
			ftv.TreeView().SetCursor(path, ftv.TreeView().GetExpanderColumn(), false)
		}
	}
}
Esempio n. 10
0
func (g *Global) SelectMapElement(melem mp.MappedElementIf) {
	cursor := g.fts.Cursor(melem)
	path, _ := gtk.TreePathNewFromString(cursor.Path)
	g.ftv.TreeView().ExpandToPath(path)
	g.ftv.TreeView().SetCursor(path, g.ftv.TreeView().GetExpanderColumn(), false)
}