package app
|
|
|
|
func (app *App) switchToScreen(name string) {
|
|
app.logger.Sugar().Debugf("switching to %s screen", name)
|
|
app.pages.SwitchToPage(name)
|
|
app.setPageFocus(name)
|
|
app.updatePageData(name)
|
|
|
|
app.currentPage = name
|
|
}
|
|
|
|
func (app *App) frontScreenHasActiveDialog() bool {
|
|
switch app.currentPage {
|
|
case app.assets.GetTitle():
|
|
return app.assets.SubDialogHasFocus()
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (app *App) switchToPreviousScreen() {
|
|
var previousScreen string
|
|
switch app.currentPage {
|
|
case app.help.GetTitle():
|
|
previousScreen = app.shelves.GetTitle()
|
|
case app.assets.GetTitle():
|
|
previousScreen = app.help.GetTitle()
|
|
case app.shelves.GetTitle():
|
|
previousScreen = app.assets.GetTitle()
|
|
}
|
|
app.switchToScreen(previousScreen)
|
|
}
|
|
|
|
func (app *App) switchToNextScreen() {
|
|
var nextScreen string
|
|
switch app.currentPage {
|
|
case app.help.GetTitle():
|
|
nextScreen = app.assets.GetTitle()
|
|
case app.assets.GetTitle():
|
|
nextScreen = app.shelves.GetTitle()
|
|
case app.shelves.GetTitle():
|
|
nextScreen = app.help.GetTitle()
|
|
}
|
|
app.switchToScreen(nextScreen)
|
|
}
|
|
|
|
func (app *App) setPageFocus(page string) {
|
|
switch page {
|
|
case app.help.GetTitle():
|
|
app.Application.SetFocus(app.help)
|
|
case app.assets.GetTitle():
|
|
app.Application.SetFocus(app.assets)
|
|
case app.shelves.GetTitle():
|
|
app.Application.SetFocus(app.shelves)
|
|
}
|
|
}
|
|
|
|
func (app *App) updatePageData(page string) {
|
|
switch page {
|
|
case app.assets.GetTitle():
|
|
app.assets.UpdateData()
|
|
case app.shelves.GetTitle():
|
|
app.shelves.UpdateData()
|
|
}
|
|
}
|