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

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jessefreeman committed Apr 29, 2020
1 parent ca7f3fd commit 4389013
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function WorkspaceTool:StartFileOperation(destPath, action)
-- Figure out the final path for the file
local finalDestPath = NewWorkspacePath(destPath.Path .. filePath.Path:sub(#self.currentPath.Path + 1))

print("filePath", filePath.Path, destPath.Path, finalDestPath.Path)
-- print("filePath", filePath.Path, destPath.Path, finalDestPath.Path)

if(filePath.isDirectory and filePath.Path == destPath.Path) then

Expand Down Expand Up @@ -224,7 +224,7 @@ function WorkspaceTool:OnRunFileAction(destPath, action, duplicate)
self.progressModal = ProgressModal:Init("File Action ", editorUI, function() self:CancelFileActions() end)

self.progressModal.fileAction = action
self.progressModal.totalFiles = (#self.targetFiles - 2)
self.progressModal.totalFiles = #self.targetFiles
end

-- Open the modal
Expand Down Expand Up @@ -267,14 +267,13 @@ function WorkspaceTool:UpdateFileActionProgress(data)
local percent = ReadExportPercent()

local fileActionActiveTotal = self.progressModal.totalFiles
local fileActionCounter = math.ceil(fileActionActiveTotal * (percent / 100))
local fileActionCounter = math.floor(fileActionActiveTotal * (percent / 100))
local pad = #tostring(fileActionActiveTotal)

local message = "test"--self.progressModal.fileAction .. " "..string.lpad(tostring(fileActionCounter), string.len(tostring(fileActionActiveTotal)), "0") .. " of " .. fileActionActiveTotal .. ".\n\n\nDo not restart or shut down Pixel Vision 8."
local message = string.format("%s %0" .. pad .. "d of %0" .. pad .. "d.\n\n\nDo not restart or shut down Pixel Vision 8.", self.progressModal.fileAction, fileActionCounter, fileActionActiveTotal)

self.progressModal:UpdateMessage(message, percent)



end

function WorkspaceTool:CanCopy(file)
Expand Down Expand Up @@ -345,51 +344,6 @@ function WorkspaceTool:OnCopy()

end

-- if(windowIconButtons ~= nil) then

-- -- Remove previous files to be copied
-- filesToCopy = {}
-- fileActionSrc = self.currentPath

-- -- TODO this needs to eventually support multiple selections

-- local file = CurrentlySelectedFile()

-- if(CanCopy(file)) then

-- local tmpPath = NewWorkspacePath(file.path)

-- -- Test if the path is a directory
-- if(tmpPath.IsDirectory) then

-- -- Add all of the files that need to be copied to the list
-- filesToCopy = GetEntitiesRecursive(tmpPath)

-- end

-- -- Make sure the selected directory is included
-- table.insert(filesToCopy, 1, NewWorkspacePath(file.path))

-- -- print("Copy File", file.name, file.path, #filesToCopy, dump(filesToCopy))

-- -- Enable the paste shortcut
-- pixelVisionOS:EnableMenuItemByName(PasteShortcut, true)

-- -- TODO eventually need to change the message to handle multiple files
-- pixelVisionOS:DisplayMessage(#filesToCopy .. " file" .. (#filesToCopy == 1 and " has" or "s have") .." been copied.", 2)

-- else

-- -- Display a message that the file can not be copied
-- pixelVisionOS:ShowMessageModal(toolName .. "Error", "'".. file.name .. "' can not be copied.", 160, false)

-- -- Make sure we can't activate paste
-- pixelVisionOS:EnableMenuItemByName(PasteShortcut, false)

-- end

-- end

end

function WorkspaceTool:OnPaste(dest)
Expand Down Expand Up @@ -431,18 +385,7 @@ function WorkspaceTool:OnPaste(dest)
pixelVisionOS:EnableMenuItemByName(PasteShortcut, false)

end
-- local destPath = NewWorkspacePath(dest)

-- -- If there are no files to copy, exit out of this function
-- if(filesToCopy == nil) then
-- return
-- end

-- -- Perform the file action validation
-- StartFileOperation(destPath, "copy")

-- pixelVisionOS:DisplayMessage("Entit" .. (#filesToCopy > 1 and "ies have" or "y has") .. " has been pasted.", 2)


end

function WorkspaceTool:OnNewFolder(name)
Expand Down Expand Up @@ -666,7 +609,7 @@ end
function WorkspaceTool:CanEject()

local selections = self:CurrentlySelectedFiles()
print("selections", dump(selections))
-- print("selections", dump(selections))

if(selections == nil) then
return
Expand Down
14 changes: 7 additions & 7 deletions Disks/PixelVisionOS/System/Tools/WorkspaceTool/code-window.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ FileTypeMap =

function WorkspaceTool:OpenWindow(path, scrollTo, selection)

print("Open", path)
-- print("Open", path)

-- Make sure the path exists before loading it up
if(PathExists(path) == false) then
Expand All @@ -42,7 +42,7 @@ function WorkspaceTool:OpenWindow(path, scrollTo, selection)



print("Loading Path", path)
-- print("Loading Path", path)

-- Configure window settings
self.iconPadding = 16
Expand Down Expand Up @@ -328,7 +328,7 @@ function WorkspaceTool:CurrentlySelectedFiles()

if(self.selectedFiles == nil) then

print("Build selected file list")
-- print("Build selected file list")

self.selectedFiles = {}

Expand Down Expand Up @@ -549,7 +549,7 @@ function WorkspaceTool:OnWindowIconSelect(id)
-- end
self:RefreshWindow()

print("Clear Selection CTRL")
-- print("Clear Selection CTRL")
-- -- clearSelections = true
end
end
Expand Down Expand Up @@ -614,7 +614,7 @@ function WorkspaceTool:OnWindowIconClick(id)
local type = tmpItem.type
local path = tmpItem.path

print("OnWindowIconClick", id, type, path)
-- print("OnWindowIconClick", id, type, path)


-- TODO need a list of things we can't delete
Expand Down Expand Up @@ -919,7 +919,7 @@ function WorkspaceTool:FileDropAction(src, dest)
return
end

print(self.files[selections[1]].path, destPath)
-- print(self.files[selections[1]].path, destPath)

-- do a quick test to make sure you don't just drop the same folder on itself and get an error
if(#selections == 1 and self.files[selections[1]].isDirectory and self.files[selections[1]].path == destPath) then
Expand Down Expand Up @@ -1269,7 +1269,7 @@ function WorkspaceTool:ClearSelections()
-- Get the current selections
local selections = self:CurrentlySelectedFiles()

print("Clearing", dump(selections))
-- print("Clearing", dump(selections))

-- Make sure there are selections
if(selections ~= nil) then
Expand Down
5 changes: 1 addition & 4 deletions Disks/PixelVisionOS/System/Tools/WorkspaceTool/saves.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
"GameChip":
{
"savedData":{
"lastPath": "/Workspace/MouseWheelTest/",
"selection": "0",
"scrollPos": "0",
"sessionID": "202004281823151383"

}
}
}

0 comments on commit 4389013

Please sign in to comment.