Skip to content

Commit

Permalink
added a search bar to search for services, usernames and passwords
Browse files Browse the repository at this point in the history
  • Loading branch information
Gyro7 committed Feb 20, 2021
1 parent 289bcc1 commit 84d2491
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Binary file modified Osiris-pwm
100644 → 100755
Binary file not shown.
24 changes: 23 additions & 1 deletion gui/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,28 @@ func Call() {
title.TextSize = 34
title.TextStyle.Bold = true
title.Alignment = fyne.TextAlignCenter

//the main searchbar with the entry, the clear button and the main search button
searchEntry := widget.NewEntry()
searchEntry.SetPlaceHolder("Search a service")
searchClear := widget.NewButton("X", func() {
go searchEntry.SetText("")
for i := 0; i < len(grids); i++ {
go grids[i].Show()
}
})
searchButton := widget.NewButtonWithIcon("", fyne.NewStaticResource("find", getIcon("gui/find.png")), func() {
for i := 0; i < len(grids); i++ {
if strings.Contains(services[i].Text, searchEntry.Text) || strings.Contains(usernames[i].Text, searchEntry.Text) || strings.Contains(passwords[i].Text, searchEntry.Text) {
go grids[i].Show()
} else {
go grids[i].Hide()
}
}
})
searchbar := container.NewGridWithColumns(3, searchEntry, searchClear, searchButton)

//description split in multiple text because I can't use "\n" with this widget
description := [6]*canvas.Text{}
description[0] = canvas.NewText("This is the first version of Osiris, it may be a bit buggy.", theme.PrimaryColor())
description[1] = canvas.NewText("To add a new element, click the add button below", theme.PrimaryColor())
Expand Down Expand Up @@ -169,7 +191,7 @@ func Call() {
legend,
)
//masterView of the app (so that it has a layout.NewSpacer after the last element)
masterView := container.NewVSplit(container.NewVScroll(mainView), layout.NewSpacer())
masterView := container.NewVSplit(container.NewVScroll(mainView), container.NewVBox(layout.NewSpacer(), searchbar))

addButton := widget.NewButtonWithIcon("", fyne.NewStaticResource("add", getIcon("gui/add.png")), func() {
services = append(services, widget.NewEntry())
Expand Down

0 comments on commit 84d2491

Please sign in to comment.