From 9c8789e72be9bc30f225a4cd6e112633b536cd6d Mon Sep 17 00:00:00 2001 From: Igor Timofeev Date: Mon, 28 May 2018 09:01:26 +0300 Subject: [PATCH] "Save" disabled context menu fix --- Applications/PictureEdit/Main.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Applications/PictureEdit/Main.lua b/Applications/PictureEdit/Main.lua index 56fb8fe5..57cc14c9 100644 --- a/Applications/PictureEdit/Main.lua +++ b/Applications/PictureEdit/Main.lua @@ -27,6 +27,7 @@ local resourcesPath = MineOSCore.getCurrentScriptDirectory() local toolsPath = resourcesPath .. "Tools/" local configPath = MineOSPaths.applicationData .. "Picture Edit/Config2.cfg" local savePath +local saveItem local tool -------------------------------------------------------------------- @@ -281,7 +282,7 @@ mainContainer.image.reposition = function() end local function newNoGUI(width, height) - savePath = nil + savePath, saveItem.disabled = nil, true mainContainer.image.data = {width, height, {}, {}, {}, {}} mainContainer.image.reposition() @@ -318,7 +319,7 @@ end local function loadImage(path) local result, reason = image.load(path) if result then - savePath = path + savePath, saveItem.disabled = path, false addRecentFile(path) mainContainer.image.data = result mainContainer.image.reposition() @@ -330,7 +331,7 @@ end local function saveImage(path) local result, reason = image.save(path, mainContainer.image.data, 6) if result then - savePath = path + savePath, saveItem.disabled = path, false addRecentFile(path) else GUI.alert(reason) @@ -383,7 +384,7 @@ fileItem:addItem("Open from URL").onTouch = function() if result then loadImage(temporaryPath) fs.remove(temporaryPath) - savePath = nil + savePath, saveItem.disabled = nil, true else GUI.alert(reason) end @@ -397,7 +398,8 @@ end fileItem:addSeparator() -fileItem:addItem("Save", not savePath).onTouch = function() +saveItem = fileItem:addItem("Save") +saveItem.onTouch = function() saveImage(savePath) end