Example #1
0
func (scr *DatabaseScreen) renderFolder(w *draw.Window, folder *database.Folder, highlight int) {
	w.Clear()
	y := 0
	items := folder.Items()

	// TODO: Paginate
	for i := range items {
		fg := termbox.ColorDefault
		bg := termbox.ColorDefault
		if items[i].Type() == database.Entry_Folder {
			fg = termbox.ColorCyan
		}
		if highlight != -1 && y == highlight {
			fg = fg | termbox.AttrReverse
			bg = bg | termbox.AttrReverse
			w.Fill(0, y, w.Width, 1, termbox.Cell{Bg: bg, Fg: fg})
		} else {
			w.Fill(0, y, w.Width, 1, termbox.Cell{Bg: bg, Fg: fg})
		}
		w.Print(0, y, fg, bg, items[i].GetName())

		y = y + 1
	}
}
Example #2
0
func (scr *DatabaseScreen) renderAccount(w *draw.Window, account *database.Account) {
	w.Print(0, 0, termbox.ColorDefault, termbox.ColorDefault, fmt.Sprintf("Username: %s", account.AccountName))
	w.Print(0, 1, termbox.ColorDefault, termbox.ColorDefault, fmt.Sprintf("URL: %s", account.URL))
	w.Print(0, 2, termbox.ColorDefault, termbox.ColorDefault, "Password: ••••••••")
}