-
Notifications
You must be signed in to change notification settings - Fork 1
/
auto_align.nim
99 lines (80 loc) · 3.18 KB
/
auto_align.nim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import tui_widget
import illwill, options, std/enumerate
var inputBox = newInputBox(id="input")
inputBox.border = true
inputBox.title = "input"
var display = newDisplay("board")
display.statusbar = true
display.enableHelp = true
display.title = "board"
display.text = """
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras quis accumsan lectus. Duis vitae rhoncus ex,
at rhoncus diam. Aenean rutrum non tellus vel finibus. In hac habitasse platea dictumst. Curabitur feugiat,
nibh laoreet tincidunt gravida, mi ante sagittis urna, sed ultricies lectus enim et libero. Nam tristique sem
tempor lectus dignissim, ac imperdiet risus auctor. Aliquam erat volutpat. In iaculis laoreet ultrices.
Curabitur pellentesque eros nec erat mattis, ac semper tortor facilisis.
Morbi quis magna laoreet, lacinia libero sed, lobortis felis. Donec vitae posuere ipsum. Curabitur volutpat
vel sem et fringilla. Quisque porttitor, urna nec tincidunt finibus, urna magna finibus ligula, sed cursus
libero mauris ut nisi. Nulla erat nisl, blandit non tincidunt eget, bibendum at nisi. Vestibulum imperdiet
nulla eu pharetra dictum. Duis vel pretium neque. Nam ac malesuada augue, quis varius purus. Vestibulum sit
amet sagittis nibh. Proin in ultricies elit. Donec euismod luctus turpis, a ultrices dui dignissim eget.
In mauris dui, sagittis et tortor sed, cursus sodales lectus. Aenean mollis velit nec purus blandit, eu
scelerisque velit venenatis. Cras ipsum urna, hendrerit volutpat ullamcorper a, vulputate et neque.
"""
# display.bg(bgWhite)
# display.fg(fgBlack)
var button = newButton(id="btn")
button.label = "Confirm"
var checkbox = newCheckbox(id="ch1")
checkbox.title = "done"
checkbox.label = "yes"
checkbox.value = "y"
var checkbox2 = newCheckbox(id="ch2")
checkbox2.title = "accept"
checkbox2.label = "yes"
checkbox2.value = "y"
checkbox2.checkMark = '*'
# checkbox2.bg(bgWhite)
# checkbox2.fg(fgBlack)
var table = newTable(id="leadtable")
table.title = "table"
table.selectionStyle = Highlight
table.loadFromCsv("./leads-1000.csv", withHeader=true, withIndex=true)
table.border = false
table.statusbar = true
# table.bg(bgWhite)
# table.fg(fgBlack)
var progress = newProgressBar(id="pb1")
button.onEnter = proc (btn: Button, args: varargs[string]) =
progress.update(5.0)
var list = newSeq[ListRow]()
const keys = {Key.A..Key.Z}
for i, key in enumerate(keys):
var listRow = newListRow(i, $key, $key)
list.add(listRow)
var listview = newListView(id="list")
listView.rows = list
listView.title = "list"
listView.bg(bgBlue)
listView.selectionStyle = HighlightArrow
var label = newLabel(id="lb1")
label.text = "hello tui"
label.bg(bgWhite)
label.fg(fgBlack)
label.align = Center
label.border = true
listView.onEnter = proc(lv: ListView, args: varargs[string]) =
label.text = args[0]
var app = newTerminalApp(title="octo")
# adding widget and assign width and height
# based on percentage.
app.addWidget(inputBox, 1.0, 2)
app.addWidget(display, 1.0, 0.2)
app.addWidget(checkbox, 0.5, 0.1)
app.addWidget(checkbox2, 0.5, 0.1)
app.addWidget(button, 1.0, 2)
app.addWidget(table, 1.0, 0.2)
app.addWidget(progress, 0.8, 2)
app.addWidget(listView, 1.0, 0.2, 0, 0, 0, 0)
app.addWidget(label, 0.2, 2, 5, -3, 0, 0)
app.run()