def OnButtonClickEditFile(self, event): selectedRowIndex = self.m_gridData.SelectedRows[0] itemID = int(self.m_gridData.GetCellValue(selectedRowIndex, 0)) name = self.m_gridData.GetCellValue(selectedRowIndex, 3) businessLogic = bl.BusinessLogic() if len(name) > 0: podFileShortcut = businessLogic.RetrievePodFileShortcutByPodFileShortcutID( itemID)['podfileshortcuts'][0] if True == self.LockPodForWriting(podFileShortcut["PodID"]): podFileId = podFileShortcut["PodFileID"] filename = podFileShortcut["Filename"] businessLogic = bl.BusinessLogic() podFileId = businessLogic.RetrieveTopRevisionFilePodIDByExistingPodFileIDFamily( podFileId)['podfileid'] uniquefolderid = str(uuid.uuid1()) os.mkdir(self.mainWindow.sandboxPath + '/' + uniquefolderid) self.mainWindow.transferEngine.DownloadFileAndWaitForCompletion( podFileId, filename, self.mainWindow.sandboxPath + '/' + uniquefolderid) localDal = dalsqlite.DalSqlite() podFile = businessLogic.RetrievePodFileByPodFileID( podFileId)['podfile'] podInformation = businessLogic.RetrieveFilePodInformation( podFileShortcut["PodID"]) localDal.AddFileInEdit(filename, uniquefolderid, podFile["PodParentFolderID"], podFileShortcut["PodID"], podInformation["pods"][0]["Name"]) if sys.platform == "win32": os.startfile(self.mainWindow.sandboxPath + '/' + uniquefolderid + '/' + filename) elif sys.platform == "darwin": subprocess.call([ 'open', self.mainWindow.sandboxPath + '/' + uniquefolderid + '/' + filename ]) else: subprocess.call([ "xdg-open", self.mainWindow.sandboxPath + '/' + uniquefolderid + '/' + filename ]) self.UnlockPod(podFileShortcut["PodID"])
def LoadDataGrid(self): businessLogic = bl.BusinessLogic() podFolderImports = businessLogic.RetrieveAllPodFolderImportsByOwnerSecurityID( self.mainWindow.loggedInSecurityUserID)['podfolderimports'] if (self.m_gridData.GetNumberRows() > 0): self.m_gridData.DeleteRows(0, 100000) self.m_gridData.AppendRows(len(podFolderImports)) for index, podFolderShare in enumerate(podFolderImports): self.m_gridData.SetCellValue( index, 0, str(podFolderShare['PodFolderImportID'])) self.m_gridData.SetCellValue(index, 1, podFolderShare['PodName']) self.m_gridData.SetCellValue(index, 2, podFolderShare['Name']) self.m_gridData.SetCellValue(index, 3, str(podFolderShare['Identifier'])) self.m_gridData.SetCellValue(index, 4, '**********') self.m_gridData.SetCellValue(index, 5, podFolderShare['Created']) self.m_gridData.SetCellValue(index, 6, podFolderShare['Descr']) self.m_gridData.SetSelectionMode(wx.grid.Grid.wxGridSelectRows) self.m_gridData.HideCol(0) self.m_buttonDelete.Disable() self.m_buttonModify.Disable()
def RunDirectoryUpload(proxyDictionary, queueOfFoldersToUpload): # create our business logic businessLogic = bl.BusinessLogic() # Log initial message logRunLogMessage(proxyDictionary["PodID"], information, 'Folder upload starting', '') # count up how much work we have to do countResults = countSizeOfFoldersAndFiles( proxyDictionary["LocalDirectoryPathToUpload"]) proxyDictionary["totalCountFiles"] += countResults[0] proxyDictionary["totalCountFolders"] += countResults[1] proxyDictionary["totalSizeInBytes"] += countResults[2] UploadFolderToServer(businessLogic, proxyDictionary, proxyDictionary["LocalDirectoryPathToUpload"], proxyDictionary["RemoteParentPodFolderID"], proxyDictionary["TreeID"], True, queueOfFoldersToUpload)
def workerthreadproc(fu, fileToUpload): while fileToUpload.writeFinished == False: try: chunk = fileToUpload.chunkProcessQueue.get(False) except Queue.Empty: chunk = None if fu.runUploader == False: return if chunk is not None: businessLogic = bl.BusinessLogic() beforecompression = len(chunk["data"]) chunk["data"] = compression.deflate(chunk["data"]) aftercompression = len(chunk["data"]) if fileToUpload.isEncrypted == True: chunk["data"] = businessLogic.EncryptData(chunk["data"], fileToUpload.encryptionPassword, fileToUpload.securityUserId) businessLogic.UploadFilePart(fileToUpload.fileId, chunk["index"], chunk["data"], beforecompression, aftercompression, fileToUpload.securityUserId) chunk["data"] = None fileToUpload.chunkWriteOutQueue.put(chunk) fileToUpload.chunkProcessQueue.task_done() else: time.sleep(.1)
def DownloadFolder(self, folderToDownload): businessLogic = bl.BusinessLogic() podFiles = businessLogic.RetrieveFilePodFilesByParentFolderID( folderToDownload.podId, folderToDownload.podFolderId) for index, podFile in enumerate(podFiles): queuedFileId = uuid.uuid1() lowestFileCountFileDownloader = self.FindLowestFileCountFileDownloader( ) lowestFileCountFileDownloader.QueueFileForDownload( queuedFileId, podFile['ExternalFileID'], folderToDownload.path + "/" + podFile['Filename'], self.theRunningOperationParameters.IsDataEncrypted, self.theRunningOperationParameters.DataEncryptionPassword, self.theRunningOperationParameters.LoggedInSecurityUserID) fileDownloading = fileDownloadingItem() fileDownloading.fileDownloader = lowestFileCountFileDownloader fileDownloading.queuedFileId = queuedFileId fileDownloading.podFileId = podFile['PodFileID'] fileDownloading.ExternalFileId = podFile['ExternalFileID'] fileDownloading.path = folderToDownload.path + "/" + podFile[ 'Filename'] self.listFilesDownloading.append(fileDownloading)
def writerthreadproc(fu, fileToUpload, totalChunks): fileToUpload.currentFileUploadingChunksCompleted = 0 while totalChunks > fileToUpload.currentFileUploadingChunksCompleted: if fileToUpload.chunkWriteOutQueue.qsize() > 0: try: chunk = fileToUpload.chunkWriteOutQueue.get(False) except Queue.Empty: chunk = None if fu.runUploader == False: return if chunk != None: fileToUpload.chunkWriteOutQueue.task_done() fileToUpload.currentFileUploadingChunksCompleted += 1 time.sleep(.1) businessLogic = bl.BusinessLogic() businessLogic.FlagFileUploadComplete(fileToUpload.PodFileID, fileToUpload.securityUserId) fileToUpload.completedSuccessfully = True fileToUpload.writeFinished = True
def RunFileDownload(proxyDictionary, queueOfFilesDownloading): businessLogic = bl.BusinessLogic() logRunLogMessage(proxyDictionary["PodID"], information, 'File download starting', '') # count up how much work we have to do proxyDictionary["totalCountFiles"] = 1 proxyDictionary["totalCountFolders"] = 0 filePath = proxyDictionary["DestinationPath"] + "/" + proxyDictionary[ "Filename"] externalfileid = businessLogic.RetrieveExternalFileIDByPodFileID( proxyDictionary["RemoteFileToDownloadID"])['externalfileid'] fileToDownload = fileDownloadingItem() fileToDownload.externalFileID = externalfileid fileToDownload.filePath = filePath fileToDownload.isDataEncrypted = proxyDictionary["IsDataEncrypted"] fileToDownload.dataEncryptionPassword = proxyDictionary[ "DataEncryptionPassword"] fileToDownload.loggedInSecurityUserID = proxyDictionary[ "LoggedInSecurityUserID"] queueOfFilesDownloading.put(fileToDownload)
def loadFilePodsSharedWithMe(self): self.treeCtrl.DeleteChildren(self.OthersFilePodsRoot) businessLogic = bl.BusinessLogic() pods = businessLogic.RetrieveFilePodsSharedWithMe( self.mainWindow.loggedInSecurityUserID) self.filePodsSharedWithMe = [] if False != pods: for pod in pods["pods"]: filePodNode = self.treeCtrl.AppendItem(self.OthersFilePodsRoot, pod['Name']) self.treeCtrl.SetItemData( filePodNode, wx.TreeItemData( treenodeinfo.TreeNodeInfo('otherfilepod', pod['PodID']))) self.treeCtrl.SetItemImage(filePodNode, 3, wx.TreeItemIcon_Normal) filePodBrowserNode = self.treeCtrl.AppendItem( filePodNode, 'Browser') self.treeCtrl.SetItemData( filePodBrowserNode, wx.TreeItemData( treenodeinfo.TreeNodeInfo('otherfilepodbrowser', pod['PodID']))) self.treeCtrl.SetItemImage(filePodBrowserNode, 0, wx.TreeItemIcon_Normal) self.filePodsSharedWithMe.append(pod)
def loadArchivedFilePods(self): self.treeCtrl.DeleteChildren(self.ArchivedFilePodsRoot) businessLogic = bl.BusinessLogic() pods = businessLogic.RetrieveFilePodsArchived( self.mainWindow.loggedInSecurityUserID) if False != pods: for pod in pods["pods"]: filePodNode = self.treeCtrl.AppendItem( self.ArchivedFilePodsRoot, pod['Name']) self.treeCtrl.SetItemData( filePodNode, wx.TreeItemData( treenodeinfo.TreeNodeInfo('myfilepod', pod['PodID']))) self.treeCtrl.SetItemImage(filePodNode, 3, wx.TreeItemIcon_Normal) filePodSettingsNode = self.treeCtrl.AppendItem( filePodNode, 'Settings') self.treeCtrl.SetItemData( filePodSettingsNode, wx.TreeItemData( treenodeinfo.TreeNodeInfo('myfilepodsettings', pod['PodID']))) self.treeCtrl.SetItemImage(filePodSettingsNode, 6, wx.TreeItemIcon_Normal) filePodBrowserNode = self.treeCtrl.AppendItem( filePodNode, 'Browser') self.treeCtrl.SetItemData( filePodBrowserNode, wx.TreeItemData( treenodeinfo.TreeNodeInfo('myfilepodbrowser', pod['PodID']))) self.treeCtrl.SetItemImage(filePodBrowserNode, 0, wx.TreeItemIcon_Normal) filePodSharingNode = self.treeCtrl.AppendItem( filePodNode, 'Sharing') self.treeCtrl.SetItemData( filePodSharingNode, wx.TreeItemData( treenodeinfo.TreeNodeInfo('myfilepodsharing', pod['PodID']))) self.treeCtrl.SetItemImage(filePodSharingNode, 7, wx.TreeItemIcon_Normal) filePodQuickShortcuts = self.treeCtrl.AppendItem( filePodNode, 'Shortcuts') self.treeCtrl.SetItemData( filePodQuickShortcuts, wx.TreeItemData( treenodeinfo.TreeNodeInfo('quickshortcuts', pod['PodID']))) self.treeCtrl.SetItemImage(filePodQuickShortcuts, 10, wx.TreeItemIcon_Normal)
def workerthreadproc(fd, fileToDownload): while fileToDownload.writeFinished == False: try: chunk = fileToDownload.chunkProcessQueue.get(False) except Queue.Empty: chunk = None if fd.runDownloader == False: return if (chunk != None): businessLogic = bl.BusinessLogic() chunk["data"] = businessLogic.DownloadFilePart( fileToDownload.fileId, chunk["index"], fileToDownload.securityUserId) if fileToDownload.isEncrypted == True: chunk["data"] = businessLogic.DecryptData( chunk["data"], fileToDownload.encryptionPassword, fileToDownload.securityUserId) chunk["data"] = compression.inflate(chunk["data"]) fileToDownload.chunkWriteOutQueue.put(chunk) fileToDownload.chunkProcessQueue.task_done() else: time.sleep(.1)
def Initialize(self, mainWindow, rightPaneInitData): self.mainWindow = mainWindow self.rightPaneInitData = rightPaneInitData self.m_radioBtnSearchingForFile.SetValue(True) self.m_buttonOpen.Disable() businessLogic = bl.BusinessLogic() mypods = businessLogic.RetrieveFilePodsByOwnerSecurityUserID( self.mainWindow.loggedInSecurityUserID)['pods'] podssharedwithme = businessLogic.RetrieveFilePodsSharedWithMe( self.mainWindow.loggedInSecurityUserID)['pods'] self.m_comboBoxPod.Clear() for mypod in mypods: self.m_comboBoxPod.Append(mypod['Name']) for podsharedwithme in podssharedwithme: self.m_comboBoxPod.Append(podsharedwithme['Name']) tags = businessLogic.RetrieveAllPreUsedTagsByOwnerSecurityUserID( self.mainWindow.loggedInSecurityUserID)['tags'] for tag in tags: self.m_checkListTags.Append(tag['Tag']) searchResults = [] self.LoadDataGrid(searchResults)
def Initialize(self, mainWindow, rightPaneInitData): self.mainWindow = mainWindow self.rightPaneInitData = rightPaneInitData businessLogic = bl.BusinessLogic() podInformation = businessLogic.RetrieveFilePodInformation( self.rightPaneInitData["podid"]) self.m_staticTextName.SetLabel('Name: ' + podInformation["pods"][0]["Name"]) self.m_staticTextDescription.SetLabel( 'Description: ' + podInformation["pods"][0]["Description"]) self.m_staticTextFileCount.SetLabel( 'File Count: ' + str(podInformation["countfiles"][0]["COUNT(*)"])) self.m_staticTextFolderCount.SetLabel( 'Folder Count: ' + str(podInformation["countfolders"])) dataSizeInBytes = podInformation["datasize"][0]["SUM(FileSizeInBytes)"] if dataSizeInBytes is None: dataSizeInBytes = 0 self.m_staticTextTotalBytesInStorage.SetLabel( 'Total Bytes In Storage: ' + str(dataSizeInBytes))
def OnButtonClickModify(self, event): selectedRowIndex = self.m_gridData.SelectedRows[0] itemID = int(self.m_gridData.GetCellValue(selectedRowIndex, 0)) name = self.m_gridData.GetCellValue(selectedRowIndex, 3) businessLogic = bl.BusinessLogic() DialogModifyShortcut = dialogmodifyshortcut.DialogModifyShortcut(self) DialogModifyShortcut.CenterOnScreen() DialogModifyShortcut.m_textCtrlNewFolderName.SetValue( self.m_gridData.GetCellValue(selectedRowIndex, 2)) result = DialogModifyShortcut.ShowModal() if result == 1: if len(name) > 0: # this is a file short cut businessLogic.ModifyPodFileShortcutName( itemID, DialogModifyShortcut.m_textCtrlNewFolderName.GetValue()) else: # this is a folder shortcut businessLogic.ModifyPodFolderShortcutName( itemID, DialogModifyShortcut.m_textCtrlNewFolderName.GetValue()) self.LoadDataGrid()
def OnButtonClickAddUser(self, event): dialogGrantUser = dialoggrantuseraccesstofilepod.DialogGrantAccessToFilePod( self) dialogGrantUser.init(self.mainWindow) dialogGrantUser.CenterOnScreen() result = dialogGrantUser.ShowModal() if result == 1: dialogWhatLevel = dialogwhataccesslevel.DialogAccessLevel(self) dialogWhatLevel.CenterOnScreen() dialogWhatLevel.ShowModal() businessLogic = bl.BusinessLogic() securityUserID = businessLogic.RetrieveSecurityUserIDByHandle( dialogGrantUser.m_textCtrlHandle.GetValue()) businessLogic.GrantHandleAccessToFilePod( securityUserID[1], self.rightPaneInitData["podid"]) if dialogWhatLevel.m_radioBtnReadOnly.GetValue() == 1: businessLogic.SetHandleWritePermissionsToFilePod( securityUserID[1], self.rightPaneInitData["podid"], 0) else: businessLogic.SetHandleWritePermissionsToFilePod( securityUserID[1], self.rightPaneInitData["podid"], 1) self.LoadDataGrid()
def LoadDataGrid(self): businessLogic = bl.BusinessLogic() self.m_buttonDeleteUser.Disable() self.m_buttonModifyAccessLevel.Disable() useraccess = businessLogic.RetrieveFilePodSecurityUserAccess( self.rightPaneInitData["podid"])["podsecurityuseraccesses"] if (self.m_gridData.GetNumberRows() > 0): self.m_gridData.DeleteRows(0, 100000) self.m_gridData.AppendRows(len(useraccess)) for index, useraccess in enumerate(useraccess): self.m_gridData.SetCellValue( index, 0, str(useraccess['PodSecurityUserAccessID'])) self.m_gridData.SetCellValue(index, 1, useraccess['Nickname']) if useraccess["CanWrite"] == 0: self.m_gridData.SetCellValue(index, 2, 'Read-Only') else: self.m_gridData.SetCellValue(index, 2, 'Read and Write') self.m_gridData.SetSelectionMode(wx.grid.Grid.wxGridSelectRows) self.m_gridData.HideCol(0)
def RunDirectoryUpload(runningOperation): # create our business logic businessLogic = bl.BusinessLogic() # Log initial message logRunLogMessage(runningOperation.theRunningOperationParameters.PodID, information, 'Folder upload starting', '') # count up how much work we have to do countResults = countSizeOfFoldersAndFiles( runningOperation.theRunningOperationParameters. LocalDirectoryPathToUpload) runningOperation.totalCountFiles += countResults[0] runningOperation.totalCountFolders += countResults[1] runningOperation.totalSizeInBytes += countResults[2] UploadFolderToServer( businessLogic, runningOperation, runningOperation. theRunningOperationParameters.LocalDirectoryPathToUpload, runningOperation.theRunningOperationParameters.RemoteParentPodFolderID, runningOperation.theRunningOperationParameters.TreeID, True) if runningOperation.shutdownNow: return # wait for our files to finish uploading while (runningOperation.totalFilesFailed + runningOperation.totalFilesProcessed ) < runningOperation.totalCountFiles: if runningOperation.shutdownNow: return time.sleep(.05) runningOperation.processFolderUploadsInThread = False runningOperation.processFilesUploadingInThread = False runningOperation.processFolderDownloadsInThread = False runningOperation.processFilesDownloadingInThread = False if (True == runningOperation.shutdownNow): return # Log final message logRunLogMessage(runningOperation.theRunningOperationParameters.PodID, information, 'Directory upload completed', '') # notify the file pod we are on when we are done runningOperation.theRunningOperationParameters.TransferEngine.mainWindow.rightPaneManager.NotifyFilePodBrowserPaneRefreshNecessary( runningOperation.theRunningOperationParameters.PodID) runningOperation.UnlockPod() runningOperation.SetPodLastChangeTime()
def filepodssharedwithmewatcherproc(treemanager): time.sleep(1) while treemanager.runFilePodsSharedWithMeWatcherThread: businessLogic = bl.BusinessLogic() podsFromServer = businessLogic.RetrieveFilePodsSharedWithMe( treemanager.mainWindow.loggedInSecurityUserID)['pods'] # check for a pod that is on the server but not in our local list, means somebody shared with us refreshed = False for serverpod in podsFromServer: foundPodInBothSpots = False for localpod in treemanager.filePodsSharedWithMe: if serverpod['PodID'] == localpod["PodID"]: foundPodInBothSpots = True break if False == foundPodInBothSpots: treemanager.loadFilePodsSharedWithMe() refreshed = True break # now look for pods we have locally that are not in the remote list, means somebody unshared and # we need to remove it from our share list if refreshed == False: cid, child = treemanager.treeCtrl.GetFirstChild( treemanager.OthersFilePodsRoot) while cid.IsOk(): treenodeinfo = treemanager.treeCtrl.GetItemData(cid).GetData() foundPodInBothSpots = False for serverpod in podsFromServer: if treenodeinfo.dbid == serverpod["PodID"]: foundPodInBothSpots = True break if False == foundPodInBothSpots: treemanager.loadFilePodsSharedWithMe() break cid, child = treemanager.treeCtrl.GetNextChild( treemanager.ArchivedFilePodsRoot, child) for i in range(0, 5): time.sleep(1) if treemanager.runFilePodsSharedWithMeWatcherThread == False: return
def LoadDataGrid(self): businessLogic = bl.BusinessLogic() self.m_buttonOpen.Disable() self.m_buttonModify.Disable() self.m_buttonDelete.Disable() self.m_buttonEditFile.Disable() self.m_buttonViewFile.Disable() if (self.m_gridData.GetNumberRows() > 0): self.m_gridData.DeleteRows(0, 100000) startingIndex = 0 if self.m_checkBoxShowFileShortcuts.GetValue() == True: podFileShortcuts = businessLogic.RetrieveAllPodFileShortcutsBySecurityUserID( self.mainWindow.loggedInSecurityUserID, 0, self.rightPaneInitData['podid'])['podfileshortcuts'] self.m_gridData.AppendRows(len(podFileShortcuts)) for index, podFileShortcut in enumerate(podFileShortcuts): self.m_gridData.SetCellValue( index, 0, str(podFileShortcut['PodFileShortcutID'])) self.m_gridData.SetCellValue(index, 1, podFileShortcut['PodName']) self.m_gridData.SetCellValue(index, 2, podFileShortcut['ShortcutName']) self.m_gridData.SetCellValue(index, 3, podFileShortcut['Filename']) self.m_gridData.SetCellValue(index, 4, '') startingIndex = len(podFileShortcuts) if self.m_checkBoxShowFolderShortcuts.GetValue() == True: podFolderShortcuts = businessLogic.RetrieveAllPodFolderShortcutsBySecurityUserID( self.mainWindow.loggedInSecurityUserID, 0, self.rightPaneInitData['podid'])['podfoldershortcuts'] self.m_gridData.AppendRows(len(podFolderShortcuts)) for index, podFolderShortcut in enumerate(podFolderShortcuts): index = index + startingIndex self.m_gridData.SetCellValue( index, 0, str(podFolderShortcut['PodFolderShortCutID'])) self.m_gridData.SetCellValue(index, 1, podFolderShortcut['PodName']) self.m_gridData.SetCellValue(index, 2, podFolderShortcut['ShortcutName']) self.m_gridData.SetCellValue(index, 3, '') self.m_gridData.SetCellValue(index, 4, podFolderShortcut['FolderName']) self.m_gridData.SetSelectionMode(wx.grid.Grid.wxGridSelectRows) self.m_gridData.HideCol(0)
def InitializeRunningOperation(self, theRunningOperationParameters): self.theRunningOperationParameters = theRunningOperationParameters businessLogic = bl.BusinessLogic() podInformation = businessLogic.RetrieveFilePodInformation( self.theRunningOperationParameters.PodID) self.Name = podInformation["pods"][0]["Name"]
def OnMenuItemDelete(self, event): selTreeItem = self.treeCtrl.GetSelection() treeNodeInfo = self.treeCtrl.GetItemData(selTreeItem).GetData() businessLogic = bl.BusinessLogic() businessLogic.DeleteFilePod(treeNodeInfo.dbid) self.loadMyFilePods()
def NotifyFilePodBrowserPaneRefreshNecessary(self, PodID): businessLogic = bl.BusinessLogic() podFolderWebShares = businessLogic.RetrieveAllPodFolderSharesByPodID( PodID)['podfoldershares'] if self.currentPanelType == 'myfilepodbrowser': self.currentPanel.LoadFilePodTree(podFolderWebShares) elif self.currentPanelType == 'otherfilepodbrowser': self.currentPanel.LoadFilePodTree(podFolderWebShares)
def LockPodForWriting(self, podID): businessLogic = bl.BusinessLogic() canWrite = businessLogic.LockFilePodForEditing(podID, self.mainWindow.loggedInSecurityUserID) if canWrite == False: wx.MessageBox('Another change to this pod is occuring so it is locked, please wait and try your modification again', 'Leopard Data filePODS', wx.OK | wx.ICON_INFORMATION) return canWrite
def InitializeRunningOperation(self, theRunningOperationParameters): self.proxyDictionary[ "OperationType"] = theRunningOperationParameters.OperationType self.proxyDictionary["PodID"] = theRunningOperationParameters.PodID self.proxyDictionary["TreeID"] = theRunningOperationParameters.TreeID self.proxyDictionary[ "RemoteParentPodFolderID"] = theRunningOperationParameters.RemoteParentPodFolderID self.proxyDictionary[ "LocalDirectoryPathToUpload"] = theRunningOperationParameters.LocalDirectoryPathToUpload self.proxyDictionary[ "LocalFilePathToUpload"] = theRunningOperationParameters.LocalFilePathToUpload self.proxyDictionary[ "RemoteFolderToDownloadID"] = theRunningOperationParameters.RemoteFolderToDownloadID self.proxyDictionary[ "DestinationPath"] = theRunningOperationParameters.DestinationPath self.proxyDictionary[ "RemoteFileToDownloadID"] = theRunningOperationParameters.RemoteFileToDownloadID self.proxyDictionary[ "Filename"] = theRunningOperationParameters.Filename self.proxyDictionary[ "IsDataEncrypted"] = theRunningOperationParameters.IsDataEncrypted self.proxyDictionary[ "DataEncryptionPassword"] = theRunningOperationParameters.DataEncryptionPassword self.proxyDictionary[ "LoggedInSecurityUserID"] = theRunningOperationParameters.LoggedInSecurityUserID self.proxyDictionary["IsRunning"] = False self.proxyDictionary["Name"] = '' self.proxyDictionary["shutdownNow"] = False self.proxyDictionary["Started"] = None self.proxyDictionary["Ended"] = None self.proxyDictionary["CompletedSuccessfully"] = False self.proxyDictionary["totalCountFiles"] = 0 self.proxyDictionary["totalCountFolders"] = 0 self.proxyDictionary["totalSizeInBytes"] = 0 self.proxyDictionary["totalFilesProcessed"] = 0 self.proxyDictionary["totalFilesFailed"] = 0 self.proxyDictionary["totalFoldersProcessed"] = 0 self.proxyDictionary["totalBytesProcessed"] = 0 self.proxyDictionary["processFolderUploadsInThread"] = True self.proxyDictionary["processFilesUploadingInThread"] = True self.proxyDictionary["processFolderDownloadsInThread"] = True self.proxyDictionary["processFilesDownloadingInThread"] = True businessLogic = bl.BusinessLogic() podInformation = businessLogic.RetrieveFilePodInformation( self.proxyDictionary["PodID"]) self.Name = podInformation["pods"][0]["Name"]
def OnButtonClickEditingComplete(self, event): localdal = dalsqlite.DalSqlite() selectedRowIndex = self.m_gridData.SelectedRows[0] FileInEditID = self.m_gridData.GetCellValue(selectedRowIndex, 0) fileInEdit = localdal.RetrieveFileInEdit(FileInEditID)[0] podID = fileInEdit[4] parentFolderID = fileInEdit[3] uniquefolderid = fileInEdit[2] filename = fileInEdit[1] businessLogic = bl.BusinessLogic() folder = businessLogic.RetrieveFolderByFolderId(parentFolderID) if folder['IsDeleted'] == 0: self.mainWindow.transferEngine.UploadFileAndWaitForCompletion( podID, parentFolderID, self.mainWindow.sandboxPath + '/' + uniquefolderid + '/' + filename) localdal.DeleteFileInEdit(FileInEditID) self.loadGridData() wx.MessageBox( 'Your file has been re uploaded to its original file pod location', 'Leopard Data filePODS', wx.OK | wx.ICON_INFORMATION) else: recoveryDir = str(uuid.uuid1()) os.makedirs(self.mainWindow.recoveryPath + "/" + recoveryDir) shutil.move( self.mainWindow.sandboxPath + "/" + uniquefolderid + "/" + filename, self.mainWindow.recoveryPath + "/" + recoveryDir + "/" + filename) localdal.DeleteFileInEdit(FileInEditID) self.loadGridData() wx.MessageBox( 'The folder your file was originally part of has been deleted, we have moved your edited file to ' + self.mainWindow.recoveryPath + "/" + recoveryDir + "/" + filename + ", please go to this location on your computer to recover your file", 'Leopard Data filePODS', wx.OK | wx.ICON_INFORMATION)
def OnButtonClickOK(self, event): businessLogic = bl.BusinessLogic() returnVal = businessLogic.IsHandleInUse( self.m_textCtrlHandle.GetValue()) if returnVal[1] == 0: self.EndModal(1) else: wx.MessageBox('Handle is already in use, please try another one!', 'Leopard Data File Pods', wx.OK | wx.ICON_ERROR)
def Initialize(self, mainWindow, rightPaneInitData): self.mainWindow = mainWindow self.rightPaneInitData = rightPaneInitData businessLogic = bl.BusinessLogic() podInformation = businessLogic.RetrieveFilePodInformation( self.rightPaneInitData["podid"]) self.m_textCtrlName.SetValue(podInformation["pods"][0]["Name"]) self.m_textCtrlDescription.SetValue( podInformation["pods"][0]["Description"])
def OnButtonClickModify(self, event): selectedRowIndex = self.m_gridData.SelectedRows[0] podFileShareID = int(self.m_gridData.GetCellValue(selectedRowIndex, 0)) businessLogic = bl.BusinessLogic() # run the dialog DialogManageFileWebSharing = dialogmanagefilewebsharing.DialogManageFileWebSharing( self) DialogManageFileWebSharing.CenterOnScreen() # if file is already shared podFileShare = businessLogic.RetrievePodFileShareByPodFileShareID( podFileShareID)['podfileshares'][0] DialogManageFileWebSharing.m_textCtrlIdentifer.SetValue( podFileShare['Identifier']) DialogManageFileWebSharing.m_textCtrlDescription.SetValue( podFileShare['Description']) if podFileShare['IsAlwaysHighestRevision'] == 0: DialogManageFileWebSharing.m_checkBoxAlwaysShareHighestRevision.Set3StateValue( False) else: DialogManageFileWebSharing.m_checkBoxAlwaysShareHighestRevision.Set3StateValue( True) result = DialogManageFileWebSharing.ShowModal() if result == 1: isAlwaysHighestRevision = None if DialogManageFileWebSharing.m_checkBoxAlwaysShareHighestRevision.GetValue( ) == True: isAlwaysHighestRevision = 1 else: isAlwaysHighestRevision = 0 businessLogic.ModifyPodFileShare( podFileShare['PodFileShareID'], podFileShare['PodID'], podFileShare['PodFileID'], self.mainWindow.loggedInSecurityUserID, isAlwaysHighestRevision, DialogManageFileWebSharing.m_textCtrlIdentifer.GetValue(), DialogManageFileWebSharing.m_textCtrlDescription.GetValue(), datetime.datetime.now().isoformat(), 0, None) self.LoadDataGrid()
def OnButtonClickDeleteTag(self, event): response = wx.MessageBox('Are you sure you want to permanently delete the selected tag!?', 'Leopard Data filePODS', wx.YES_NO | wx.ICON_QUESTION) if response == 2: systemEntityTagId = self.m_gridData.GetCellValue(self.m_gridData.SelectedRows[0], 0) businessLogic = bl.BusinessLogic() businessLogic.DeleteTag(systemEntityTagId) self.LoadDataGrid()
def OnButtonClickOpen(self, event): selectedRowIndex = self.m_gridData.SelectedRows[0] itemID = int(self.m_gridData.GetCellValue(selectedRowIndex, 0)) name = self.m_gridData.GetCellValue(selectedRowIndex, 3) businessLogic = bl.BusinessLogic() if len(name) > 0: podFileShortcut = businessLogic.RetrievePodFileShortcutByPodFileShortcutID(itemID)['podfileshortcuts'][0] self.mainWindow.treeManager.NavigateToPodFile(podFileShortcut['PodID'], podFileShortcut['PodParentFolderID'], podFileShortcut['PodFileID']) else: podFolderShortcut = businessLogic.RetrievePodFolderShortcutByPodFolderShortcutID(itemID)['podfoldershortcuts'][0] self.mainWindow.treeManager.NavigateToPodFolder(podFolderShortcut['PodID'], podFolderShortcut['PodParentFolderID'])
def OnButtonClickDelete(self, event): response = wx.MessageBox( 'Are you sure you want to permanently delete the selected folder web share!?', 'Leopard Data filePODS', wx.YES_NO | wx.ICON_QUESTION) if response == 2: selectedRowIndex = self.m_gridData.SelectedRows[0] podFolderImportID = int( self.m_gridData.GetCellValue(selectedRowIndex, 0)) businessLogic = bl.BusinessLogic() businessLogic.DeletePodFolderImport(podFolderImportID) self.LoadDataGrid()