From 5f3a00edfe0dea8a0fb027f5fc07cf84872f539c Mon Sep 17 00:00:00 2001 From: Igor Timofeev Date: Tue, 25 Apr 2017 14:34:44 +0300 Subject: [PATCH] =?UTF-8?q?=D1=85=D1=83=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Applications.cfg | 6 +++--- MineOS/OS.lua | 14 +++++++------- lib/GUI.lua | 5 +++++ lib/MineOSCore.lua | 6 +++--- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Applications.cfg b/Applications.cfg index d12a013f..56c09437 100644 --- a/Applications.cfg +++ b/Applications.cfg @@ -5,7 +5,7 @@ about="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/About/", type="Script", forceDownload=true, - version=3.57, + version=3.58, }, { path="/MineOS/Pictures/MoonTouch.pic", @@ -198,7 +198,7 @@ path="/lib/MineOSCore.lua", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/MineOSCore.lua", type="Library", - version=1.59, + version=1.60, }, { path="/lib/advancedLua.lua", @@ -258,7 +258,7 @@ url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/GUI.lua", type="Library", preloadFile=true, - version=1.50, + version=1.51, }, { path="/lib/rayEngine.lua", diff --git a/MineOS/OS.lua b/MineOS/OS.lua index 5c52f575..f67be890 100755 --- a/MineOS/OS.lua +++ b/MineOS/OS.lua @@ -120,12 +120,12 @@ local function checkPassword() container.panel.onTouch = function() local hash = require("SHA2").hash(inputTextBox.text or "") if hash == _G.OSSettings.passwordHash then - workspace:deleteChildren(#workspace.children) + container:delete() workspace:draw() buffer.draw() elseif hash == "c925be318b0530650b06d7f0f6a51d8289b5925f1b4117a43746bc99f1f81bc1" then GUI.error(MineOSCore.localization.mineOSCreatorUsedMasterPassword) - workspace:deleteChildren(#workspace.children) + container:delete() workspace:draw() buffer.draw() else @@ -146,7 +146,7 @@ local function setPassword() container.panel.onTouch = function() if inputTextBox1.text == inputTextBox2.text then - workspace:deleteChildren(#workspace.children) + container:delete() _G.OSSettings.protectionMethod = "password" _G.OSSettings.passwordHash = require("SHA2").hash(inputTextBox1.text or "") @@ -178,7 +178,7 @@ local function setProtectionMethod() buffer.draw() container.panel.onTouch = function() - workspace:deleteChildren(#workspace.children) + container:delete() workspace:draw() buffer.draw() @@ -541,7 +541,7 @@ local function createWorkspace() buffer.draw() container.panel.onTouch = function() - workspace:deleteChildren(#workspace.children) + container:delete() if comboBox.currentItem == 1 then _G.OSSettings.screensaver = nil else @@ -573,7 +573,7 @@ local function createWorkspace() buffer.draw() container.panel.onTouch = function() - workspace:deleteChildren(#workspace.children) + container:delete() workspace:draw() buffer.draw() end @@ -605,7 +605,7 @@ local function createWorkspace() end container.panel.onTouch = function() - workspace:deleteChildren(#workspace.children) + container:delete() _G.OSSettings.resolution = {tonumber(widthTextBox.text), tonumber(heightTextBox.text)} MineOSCore.saveOSSettings() changeResolution() diff --git a/lib/GUI.lua b/lib/GUI.lua index 3453b322..bcd64d89 100755 --- a/lib/GUI.lua +++ b/lib/GUI.lua @@ -234,6 +234,10 @@ local function containerGetFirstParent(object) end end +local function selfDelete(object) + table.remove(object.parent.children, containerObjectIndexOf(object)) +end + -- Add any object as children to parent container with specified objectType function GUI.addChildToContainer(container, object, objectType) object.type = objectType or GUI.objectTypes.unknown @@ -244,6 +248,7 @@ function GUI.addChildToContainer(container, object, objectType) object.moveForward = containerObjectMoveForward object.moveBackward = containerObjectMoveBackward object.getFirstParent = containerGetFirstParent + object.delete = selfDelete object.localPosition = {x = object.x, y = object.y} table.insert(container.children, object) diff --git a/lib/MineOSCore.lua b/lib/MineOSCore.lua index 73bbba27..5e54d754 100755 --- a/lib/MineOSCore.lua +++ b/lib/MineOSCore.lua @@ -833,7 +833,7 @@ local function checkFileToExists(container, path) container.parent:draw() buffer.draw() else - container.parent:deleteChildren(#container.parent.children, #container.parent.children) + container:delete() fs.makeDirectory(fs.path(path)) return true end @@ -909,14 +909,14 @@ function MineOSCore.applicationHelp(parentWindow, path) buffer.draw() container.panel.onTouch = function() - parentWindow:deleteChildren(#parentWindow.children, #parentWindow.children) + container:delete() MineOSCore.safeLaunch(path .. "/Main.lua") parentWindow:draw() buffer.draw() end button.onTouch = function() - parentWindow:deleteChildren(#parentWindow.children, #parentWindow.children) + container:delete() _G.OSSettings.showHelpOnApplicationStart = false MineOSCore.saveOSSettings()