Compare commits
2 commits
6c54f462db
...
7413d5427c
Author | SHA1 | Date | |
---|---|---|---|
Ben | 7413d5427c | ||
Ben | 2a0176888a |
|
@ -35,7 +35,7 @@ local function displayTab(self)
|
||||||
local tw,th = self.window.getSize()
|
local tw,th = self.window.getSize()
|
||||||
for i, val in pairs(orders) do
|
for i, val in pairs(orders) do
|
||||||
local line_num = (i-self.scrollPos)*2+1
|
local line_num = (i-self.scrollPos)*2+1
|
||||||
if line_num > 2 and line_num < th-1 then
|
if line_num > 0 and line_num < th-1 then
|
||||||
self.window.setTextColor(colors.lightGray)
|
self.window.setTextColor(colors.lightGray)
|
||||||
self.window.setCursorPos(1,line_num)
|
self.window.setCursorPos(1,line_num)
|
||||||
self.window.write(val.id)
|
self.window.write(val.id)
|
||||||
|
|
|
@ -51,7 +51,7 @@ local function displayTab(self)
|
||||||
display_list = {}
|
display_list = {}
|
||||||
for i, val in pairs(requests) do
|
for i, val in pairs(requests) do
|
||||||
local line_num = i-self.scrollPos+1
|
local line_num = i-self.scrollPos+1
|
||||||
if line_num > 2 and line_num < th then
|
if line_num > 0 and line_num < th then
|
||||||
self.window.setTextColor(colors.white)
|
self.window.setTextColor(colors.white)
|
||||||
self.window.setCursorPos(1,line_num)
|
self.window.setCursorPos(1,line_num)
|
||||||
self.window.write(val.req.name)
|
self.window.write(val.req.name)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
local parent = term.current()
|
local parent = term.current()
|
||||||
|
local tabCount = 0
|
||||||
local allTabs = {}
|
local allTabs = {}
|
||||||
local tabOrder = {}
|
local tabOrder = {}
|
||||||
local currentTab = nil
|
local currentTab = nil
|
||||||
|
@ -26,6 +27,7 @@ local function addTab(tab, order_idx)
|
||||||
end
|
end
|
||||||
allTabs[tab.name] = tab
|
allTabs[tab.name] = tab
|
||||||
tabOrder[order_idx] = tab.name
|
tabOrder[order_idx] = tab.name
|
||||||
|
tabCount = tabCount + 1
|
||||||
return tab
|
return tab
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -43,14 +45,14 @@ local function showTab(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function switchTab()
|
local function switchTab()
|
||||||
assert(#allTabs > 0, "tabs need to be registered in order to switch tabs")
|
assert(tabCount > 0, "tabs need to be registered in order to switch tabs")
|
||||||
local idx = 0
|
local idx = 0
|
||||||
if currentTab ~= nil then
|
if currentTab ~= nil then
|
||||||
currentTab.window.setVisible(false)
|
currentTab.window.setVisible(false)
|
||||||
idx = tabOrder[currentTab.name]
|
idx = tabOrder[currentTab.name]
|
||||||
end
|
end
|
||||||
idx = idx + 1
|
idx = idx + 1
|
||||||
if idx > #allTabs then
|
if idx > tabCount then
|
||||||
idx = 1
|
idx = 1
|
||||||
end
|
end
|
||||||
currentTab = allTabs[tabOrder[idx]]
|
currentTab = allTabs[tabOrder[idx]]
|
||||||
|
|
Loading…
Reference in a new issue