Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local GUI = require("GUI")
- local system = require("System")
- local internet = require("Internet")
- local paths = require("Paths")
- local filesystem = require("Filesystem")
- local image = require("Image")
- --------------------------------------------------------------------------------
- local currentScriptDirectory = filesystem.path(system.getCurrentScript())
- local localization = system.getLocalization(currentScriptDirectory .. "Localizations/")
- local pictures = { -- Список обоев.
- "Sea Tropics Maldives",
- "Anime winter",
- "Winter mountains",
- "Nvidia",
- "Ryzen",
- "Ryzen 160x33",
- "Intel",
- "Space",
- "New York",
- "Windows 10",
- "Google",
- "High Sierra",
- "Mojave",
- "london",
- "hentai 1",
- "anime girl",
- "LandScape",
- }
- table.sort(pictures, function(a, b) return unicode.lower(a) < unicode.lower(b) end)
- --------------------------------------------------------------------------------
- local workspace, window = system.addWindow(GUI.filledWindow(1, 1, 50, 21, 0xF0F0F0)) -- окно
- local layout = window:addChild(GUI.layout(1, 3, 1, 1, 1, 1))
- layout:addChild(GUI.image(1, 1, image.load(currentScriptDirectory .. "Icon.pic")))
- local comboBox = layout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0xD2D2D2, 0xA5A5A5))
- comboBox.dropDownMenu.itemHeight = 1
- comboBox.dropDownMenu.scrollSpeed = 2
- for i = 1, #pictures do
- comboBox:addItem(pictures[i])
- end
- local button = layout:addChild(GUI.button(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0xD2D2D2, 0x3C3C3C, localization.download))
- button.animated = false
- local switch = layout:addChild(GUI.switchAndLabel(1, 1, 41, 6, 0x336DFF, 0xE1E1E1, 0xFFFFFF, 0xA5A5A5, localization.what, true)).switch
- local progressIndicator = layout:addChild(GUI.progressIndicator(1, 1, 0xE1E1E1, 0x004980, 0x006DFF))
- local function download(file)
- progressIndicator.active = true
- workspace:draw()
- local handle, reason = filesystem.open(paths.system.pictures .. file, "wb")
- if handle then
- local success, reason = internet.rawRequest(
- "https://github.com/Fronun/Wallpapers/raw/stable/wall/" .. internet.encode(file),
- nil,
- nil,
- function(chunk)
- handle:write(chunk)
- progressIndicator:roll()
- workspace:draw()
- end,
- math.huge
- )
- handle:close()
- if success then
- if switch.state then
- local userSettings = system.getUserSettings()
- userSettings.interfaceWallpaperPath = paths.system.pictures .. file
- userSettings.interfaceWallpaperEnabled = true
- system.updateWallpaper()
- workspace:draw()
- system.saveUserSettings()
- end
- else
- GUI.alert("Failed to download wallpaper: ", reason)
- end
- else
- GUI.alert("Failed to open file handle: ", reason)
- end
- progressIndicator.active = false
- workspace:draw()
- end
- button.onTouch = function()
- download(comboBox:getItem(comboBox.selectedItem).text .. ".pic")
- end
- local labelServer = layout:addChild(GUI.text(1, 1, 0xD2D2D2, "Server by Guild-BT (Sotq)"))
- window.onResize = function(width, height)
- window.backgroundPanel.width, window.backgroundPanel.height = width, height
- layout.width, layout.height = width, height - layout.localY + 1
- end
- --------------------------------------------------------------------------------
- window:resize(window.width, window.height)
- workspace:draw()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement