Работа над отображением объектов, работа со стилями, работа с позиционированиме, изменение таблицы переменных
This commit is contained in:
parent
ada7db46cf
commit
2e8eee135e
7 changed files with 477 additions and 431 deletions
|
|
@ -67,8 +67,24 @@ func (m *Main) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||
}
|
||||
case tea.KeyMsg:
|
||||
switch msg.String() {
|
||||
case "ctrl+c", "q":
|
||||
return m, tea.Quit
|
||||
case "ctrl+c":
|
||||
return m, func() tea.Msg {
|
||||
return types.ShowModalMsg{
|
||||
Type: types.ModalWarning,
|
||||
Title: "Закрытие приложения",
|
||||
Message: "Вы нажали ctrl+c, вы желаете закрыть приложение?",
|
||||
ModalButtons: []types.ModalButton{
|
||||
{Text: "Закрыть приложение", Value: true},
|
||||
{Text: "Не закрывать", Value: false},
|
||||
},
|
||||
OnResult: func(result any) tea.Cmd {
|
||||
if result == true {
|
||||
return tea.Quit
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
case types.NextSectionMsg:
|
||||
m.CurrentSectionIdx++
|
||||
|
|
@ -103,14 +119,12 @@ func (m *Main) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||
m.current = NewFinalModel(m.CurrentApplication.Variables, m.Width, m.Height)
|
||||
} else {
|
||||
m.current = NewFormModel(m.CurrentApplication, m.CurrentSectionIdx, 0, m.Width, m.Height)
|
||||
|
||||
}
|
||||
case types.SugarMsg:
|
||||
m.Sugar(msg)
|
||||
case types.SelectedAppMsg:
|
||||
//получаем сообщение о выборе приложения
|
||||
m.CurrentApplication = &msg.App
|
||||
|
||||
//ищем доступную секцию
|
||||
for sectionIdx := 0; sectionIdx < len(m.CurrentApplication.Sections); sectionIdx++ {
|
||||
section := m.CurrentApplication.Sections[sectionIdx]
|
||||
|
|
@ -136,7 +150,6 @@ func (m *Main) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||
m.overlay = NewModalModel(msg, m.Width, m.Height)
|
||||
return m, nil
|
||||
case types.CloseModalMsg:
|
||||
logrus.Infof("modal close msg get")
|
||||
m.overlay = nil
|
||||
return m, tea.Batch(cmds...)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue