Skip to content
Snippets Groups Projects
Commit b04cea16 authored by Malte Bauch's avatar Malte Bauch
Browse files

refactoring struct

- commandsListView
- mainView
-resultAndInputView
parent acbdc480
No related branches found
No related tags found
3 merge requests!90Develop,!59Resolve "Simple ncurse-alike cli to manage gosdn",!53V.0.1.0 Codename Threadbare
...@@ -11,10 +11,10 @@ type CommandListView struct { ...@@ -11,10 +11,10 @@ type CommandListView struct {
} }
func NewCommandListView(rootTitle string) *CommandListView { func NewCommandListView(rootTitle string) *CommandListView {
v := &CommandListView{
v := &CommandListView{} rootNode: tview.NewTreeNode(rootTitle),
v.rootNode = tview.NewTreeNode(rootTitle) commandsTree: tview.NewTreeView(),
v.commandsTree = tview.NewTreeView() }
v.commandsTree. v.commandsTree.
SetRoot(v.rootNode). SetRoot(v.rootNode).
SetTitle("Commands"). SetTitle("Commands").
......
...@@ -10,14 +10,14 @@ type MainView struct { ...@@ -10,14 +10,14 @@ type MainView struct {
} }
func NewMainView() *MainView { func NewMainView() *MainView {
v := &MainView{} v := &MainView{
v.pages = tview.NewPages() pages: tview.NewPages(),
v.resultAndInputView = NewResultAndInputView() mainFlexBox: createFlexBox(tview.FlexColumn),
v.commandsListView = NewCommandListView("") commandsListView: NewCommandListView(""),
resultAndInputView: NewResultAndInputView(),
}
v.commandsListView.GetCommands("../") v.commandsListView.GetCommands("../")
v.mainFlexBox = createFlexBox(tview.FlexColumn)
commandsFlexBox := createFlexBox(tview.FlexRow) commandsFlexBox := createFlexBox(tview.FlexRow)
commandsFlexBox.AddItem(v.commandsListView.GetContent(), 0, 40, true) commandsFlexBox.AddItem(v.commandsListView.GetContent(), 0, 40, true)
......
...@@ -10,8 +10,9 @@ type ResultAndInputView struct { ...@@ -10,8 +10,9 @@ type ResultAndInputView struct {
} }
func NewResultAndInputView() *ResultAndInputView { func NewResultAndInputView() *ResultAndInputView {
v := &ResultAndInputView{} v := &ResultAndInputView{
v.resultAndInputView = tview.NewTextView() resultAndInputView: tview.NewTextView(),
}
v.resultAndInputView. v.resultAndInputView.
SetDynamicColors(true). SetDynamicColors(true).
SetRegions(true). SetRegions(true).
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment