Skip to content
This repository has been archived by the owner on Jan 4, 2023. It is now read-only.

Commit

Permalink
Cleaning up issues with file actions.
Browse files Browse the repository at this point in the history
  • Loading branch information
jessefreeman committed May 2, 2020
1 parent 1348624 commit 44c00ac
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 47 deletions.
10 changes: 5 additions & 5 deletions Disks/PixelVisionOS/System/Tools/TextEditorTool/saves.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"GameChip":
{
"savedData":{
"scroll": "1,1",
"selectedSprite": "0",
"cursor": "1,1",
"targetFile": "/Disks/PixelVisionOS/info.json",
"sessionID": "202005020908199470",
"rootDirectory": "/Workspace/HelloWorld/",
"sessionID": "202005011328585504",
"targetFile": "/Workspace/MouseWheelTest/code.lua"
"cursor": "1,1",
"selectedSprite": "0",
"scroll": "1,1"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,14 @@ function WorkspaceTool:OnEjectDisk(diskPath)
end


function WorkspaceTool:UpdateContextMenu(inFocus)
function WorkspaceTool:UpdateContextMenu()

-- print("UpdateContextMenu", inFocus)

local selections = self:CurrentlySelectedFiles()

-- Check to see if currentPath is a game
local canRun = pixelVisionOS:ValidateGameInDir(self.currentPath, {"code.lua"})-- and selections
local canRun = self.focus == true and self.isGameDir--and pixelVisionOS:ValidateGameInDir(self.currentPath, {"code.lua"})-- and selections

-- Look to see if the selection is a special file (parent dir or run)
local specialFile = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ function WorkspaceTool:OnRunFileAction(srcPath, destPath, action, duplicate)

local success = RunBackgroundScript("code-process-file-actions.lua", args)

print("Total Files", ReadMetadata("tmpFileCount"))
-- print("success", success)

if(success) then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function CalculateSteps()
}
)

print("Action", childPath.Path, childDest.Path)
-- print("Action", childPath.Path, childDest.Path)

-- Add a new file action to the task
AddStep("OnFileActionNextStep")
Expand All @@ -83,6 +83,8 @@ function CalculateSteps()

end

-- WriteMetadata( "tmpFileCount", tostring(#filesToCopy) )

end

fileActionCounter = 1
Expand All @@ -96,19 +98,31 @@ end

function OnFileActionNextStep()


-- Get the src and dest paths from the files list
local filePath = filesToCopy[fileActionCounter].src
local finalDestPath = filesToCopy[fileActionCounter].dest

-- print("OnFileActionNextStep", filePath, finalDestPath)


if(filePath.IsFile) then

TriggerSingleFileAction(filePath, finalDestPath)

elseif(action ~= "copy") then
else

-- print("Make Folder", filePath, finalDestPath.Path)

table.insert(fileCleanup, filePath)
if(action ~= "delete" and PathExists(finalDestPath) == false) then
CreateDirectory(finalDestPath)
end

end
if(action ~= "copy") then
table.insert(fileCleanup, filePath)
end

end

fileActionCounter = fileActionCounter + 1

Expand Down
50 changes: 34 additions & 16 deletions Disks/PixelVisionOS/System/Tools/WorkspaceTool/code-window.lua
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,8 @@ function WorkspaceTool:DrawWindow()
-- Reset the component's validation once drwaing is done
editorUI:ResetValidation(self)

self:UpdateContextMenu()

end

function WorkspaceTool:OnOverDropTarget(src, dest)
Expand Down Expand Up @@ -870,7 +872,7 @@ function WorkspaceTool:FileDropAction(src, dest)
return

else
-- print("Trash")
print("Trash")
action = "throw out"
end
elseif(srcSeg[1] == "Disks" and destSeg[1] == "Disks") then
Expand All @@ -882,7 +884,7 @@ function WorkspaceTool:FileDropAction(src, dest)
end

-- Perform the file action
-- self:StartFileOperation(self.currentPath, destPath, action)
self:StartFileOperation(self.currentPath, destPath, action)

end

Expand Down Expand Up @@ -1052,24 +1054,40 @@ function WorkspaceTool:GetDirectoryContents(workspacePath)

end

-- Check to see if this is a game directory
local srcSeg = workspacePath.GetDirectorySegments()

print("ValidateGameInDir", dump(srcSeg))

local totalSeg = #srcSeg

-- Check to see if this is a game directory and we should display the run exe
if(pixelVisionOS:ValidateGameInDir(workspacePath, {"code.lua"}) and self:TrashOpen() == false) then

-- Add an entity to run the game
table.insert(
entities,
{
name = "Run",
type = "run",
ext = "run",
path = self.currentPath,
isDirectory = false,
selected = false
}
)
if((srcSeg[1] == "Disks" and totalSeg < 3) or (srcSeg[1] == "Workspace" and totalSeg ~= 1)) then

-- Add an entity to run the game
table.insert(
entities,
{
name = "Run",
type = "run",
ext = "run",
path = self.currentPath,
isDirectory = false,
selected = false
}
)

self.totalSingleSelectFiles = self.totalSingleSelectFiles + 1
self.totalSingleSelectFiles = self.totalSingleSelectFiles + 1

self.isGameDir = true

else
self.isGameDir = false

end


end

-- Get all of the entities in the directory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,6 @@ LoadScript("pixel-vision-os-item-picker-v1")

function WorkspaceTool:Init()

-- -- Create an global instance of the Pixel Vision OS
-- pixelVisionOS = PixelVisionOS:Init()

-- Used for debugging
-- pixelVisionOS.displayFPS = true

-- Get a global reference to the Editor UI
-- editorUI = pixelVisionOS.editorUI

-- Create a new table for the instance with default properties
local _workspaceTool = {
toolName = "Workspace Explorer",
Expand All @@ -50,12 +41,6 @@ function WorkspaceTool:Init()
-- Change the title
pixelVisionOS:ChangeTitle(_workspaceTool.toolName, "toolbaricontool")

-- Create background
-- _workspaceTool:DrawWallpaper()
-- _workspaceTool:RebuildDesktopIcons()



-- Create dropdown menu
_workspaceTool:CreateDropDownMenu()

Expand Down Expand Up @@ -84,6 +69,7 @@ end

function WorkspaceTool:RestoreLastPath()

-- TODO ned to restore selections correctly
local newPath = SessionID() == ReadSaveData("sessionID", "") and ReadSaveData("lastPath", "none") or "none"
local lastScrollPos = tonumber(ReadSaveData("scrollPos", "0"))
local lastSelection = tonumber(ReadSaveData("selection", "0"))
Expand Down
6 changes: 3 additions & 3 deletions Disks/PixelVisionOS/System/Tools/WorkspaceTool/saves.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"GameChip":
{
"savedData":{
"lastPath": "/Workspace/Screenshots/",
"selection": "6",
"sessionID": "202005020932457470",
"scrollPos": "0",
"sessionID": "202005011614087705"
"selection": "0",
"lastPath": "/Workspace/MyFirstGame/NewProject/"
}
}
}
3 changes: 1 addition & 2 deletions SDK/Engine/Chips/Graphics/DisplayChip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,7 @@ public DrawRequest NextDrawRequest()
// int index;

_total = width * height;



for (i1 = 0; i1 < _total; i1++)
{
_colorID = pixelData?[i1] ?? 0;
Expand Down

0 comments on commit 44c00ac

Please sign in to comment.