diff --git a/Applications.cfg b/Applications.cfg index 0b1a4332..1aa16e3b 100644 --- a/Applications.cfg +++ b/Applications.cfg @@ -236,7 +236,7 @@ path="/lib/MineOSInterface.lua", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/MineOSInterface.lua", type="Library", - version=1.02, + version=1.04, }, { path="/lib/MineOSPaths.lua", diff --git a/ImageConverter/.idea/workspace.xml b/ImageConverter/.idea/workspace.xml index 2baf8adb..b37e4467 100644 --- a/ImageConverter/.idea/workspace.xml +++ b/ImageConverter/.idea/workspace.xml @@ -67,22 +67,14 @@ - - - - - - - - - - - - - - + + + + + + @@ -134,15 +126,14 @@ - @@ -165,6 +156,8 @@ + + @@ -233,8 +226,6 @@ - - @@ -520,18 +511,19 @@ - + + - + @@ -552,7 +544,6 @@ - @@ -583,6 +574,10 @@ + + + + @@ -620,15 +615,15 @@ + + + - - - @@ -646,6 +641,10 @@ + + + + @@ -683,15 +682,15 @@ + + + - - - @@ -709,6 +708,10 @@ + + + + @@ -746,15 +749,15 @@ + + + - - - @@ -772,6 +775,10 @@ + + + + @@ -819,15 +826,15 @@ + + + - - - @@ -835,6 +842,10 @@ + + + + @@ -887,6 +898,10 @@ + + + + @@ -946,20 +961,20 @@ + + + - - - - + @@ -969,10 +984,14 @@ - - + + + + + + diff --git a/ImageConverter/out/production/ImageConverter/sample/ImageConverter.fxml b/ImageConverter/out/production/ImageConverter/sample/ImageConverter.fxml index 01e0bc6e..483fe1ea 100644 --- a/ImageConverter/out/production/ImageConverter/sample/ImageConverter.fxml +++ b/ImageConverter/out/production/ImageConverter/sample/ImageConverter.fxml @@ -112,5 +112,6 @@ + diff --git a/lib/MineOSInterface.lua b/lib/MineOSInterface.lua index c83c4549..2b352e09 100755 --- a/lib/MineOSInterface.lua +++ b/lib/MineOSInterface.lua @@ -89,7 +89,12 @@ local function iconDraw(icon) buffer.image(icon.x + 2, icon.y, icon.semiTransparentImage, true) else - buffer.image(icon.x + 2, icon.y, icon.image) + + if icon.image then + buffer.image(icon.x + 2, icon.y, icon.image) + elseif icon.liveImage then + icon.liveImage(icon.x + 2, icon.y) + end end if icon.isShortcut then @@ -148,6 +153,7 @@ function MineOSInterface.icon(x, y, path, textColor, selectionColor) selection = selectionColor, selectionTransparency = 0.6 } + icon.path = path icon.isDirectory = fs.isDirectory(icon.path) icon.extension = fs.extension(icon.path) or "script" @@ -238,7 +244,23 @@ function iconAnalyseExtension(icon) if icon.isDirectory then if icon.extension == ".app" then if MineOSCore.properties.showApplicationIcons then - icon.image = image.load(icon.path .. "/Resources/Icon.pic") + if fs.exists(icon.path .. "/Resources/Icon.pic") then + icon.image = image.load(icon.path .. "/Resources/Icon.pic") + elseif fs.exists(icon.path .. "/Resources/Icon.lua") then + local data, reason = loadfile(icon.path .. "/Resources/Icon.lua") + if data then + data, reason = data() + if data then + icon.liveImage = data + else + error("Failed to load live icon image: " .. tostring(reason)) + end + else + error("Failed to load live icon image: " .. tostring(reason)) + end + else + icon.image = MineOSInterface.iconsCache.fileNotExists + end else icon.image = MineOSInterface.iconsCache.application end @@ -793,7 +815,7 @@ function MineOSInterface.iconRightClick(icon, eventData) menu:addItem(MineOSCore.localization.properties).onTouch = function() for i = 1, #selectedIcons do - MineOSCore.propertiesWindow(eventData[3], eventData[4], 40, selectedIcons[i]) + MineOSInterface.propertiesWindow(eventData[3], eventData[4], 40, selectedIcons[i]) end end