Skip to content

Commit

Permalink
Add 'Reload versions list' button to Everest install screen
Browse files Browse the repository at this point in the history
  • Loading branch information
maddie480 committed Aug 29, 2023
1 parent 45d986c commit 9d5c3cb
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 15 deletions.
3 changes: 2 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ Its purpose is to be shown in Olympus when updating.

#changelog#
∙ Added an "Update All" button to the Manage Installed Mods screen
∙ Added Noto Sans font to make Olympus able to render Russian characters
∙ Added Noto Sans font to make Olympus able to render Russian characters
∙ Added a "Reload versions list" button to the Everest install screen
48 changes: 34 additions & 14 deletions src/scenes/everest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@ local root = uie.column({
mainmenu.createInstalls(),

uie.paneled.column({
uie.label("Versions", ui.fontBig),
uie.row({
uie.label("Versions", ui.fontBig),
uie.button("Reload versions list", function()
local list = scene.root:findChild("versions")
list.children = {}
list:reflow()
scene.load()
end):with(uiu.rightbound):as("reloadVersionsList"),
}):with(uiu.fillWidth):as("titlebar"),
uie.panel({
uie.label({{ 1, 1, 1, 1 },
[[Use the newest version for more features and bugfixes.
Expand All @@ -35,7 +43,6 @@ Use the latest ]], { 0.3, 0.8, 0.5, 1 }, "stable", { 1, 1, 1, 1 }, " or ", { 0.8
}):with(uiu.fillWidth),

uie.column({

uie.scrollbox(
uie.list({
}):with({
Expand All @@ -44,18 +51,6 @@ Use the latest ]], { 0.3, 0.8, 0.5, 1 }, "stable", { 1, 1, 1, 1 }, " or ", { 0.8
list.selected = list.children[1] or false
end):as("versions")
):with(uiu.fill),

uie.paneled.row({
uie.label("Loading"),
uie.spinner():with({
width = 16,
height = 16
})
}):with({
clip = false,
cacheable = false
}):with(uiu.bottombound):with(uiu.rightbound):as("loadingVersions")

}):with({
clip = false
}):with(uiu.fillWidth):with(uiu.fillHeight(true)):as("versionsParent")
Expand Down Expand Up @@ -408,6 +403,28 @@ end
function scene.load()

threader.routine(function()
-- remove the displayed error if we are retrying after the versions list loading failed
local previousError = root:findChild("error")
if previousError then
previousError:removeSelf()
end

root:findChild("reloadVersionsList").enabled = false

-- display a "Loading" spinner
root:findChild("versionsParent"):addChild(
uie.paneled.row({
uie.label("Loading"),
uie.spinner():with({
width = 16,
height = 16
})
}):with({
clip = false,
cacheable = false
}):with(uiu.bottombound):with(uiu.rightbound):as("loadingVersions")
)

local utilsAsync = threader.wrap("utils")
local buildsTask = utilsAsync.download("https://everestapi.github.io/everestupdater.txt")
local url, buildsError = buildsTask:result()
Expand All @@ -434,6 +451,7 @@ function scene.load()
cacheable = false
}):with(uiu.bottombound):with(uiu.rightbound):as("error"))
list:addChild(manualItem)
root:findChild("reloadVersionsList").enabled = true
return
end

Expand Down Expand Up @@ -536,6 +554,8 @@ function scene.load()

root:findChild("loadingVersions"):removeSelf()
list:addChild(manualItem)

root:findChild("reloadVersionsList").enabled = true
end)

end
Expand Down

0 comments on commit 9d5c3cb

Please sign in to comment.