class U1FinderLib(NSObject): ## # Default constructor. @objc.typedSelector('@@:@') def initWithDelegate_(self, delegate): self = super(U1FinderLib, self).init() self.sync_daemon_tool = SyncDaemonTool(None) self.delegate = delegate cfreactor.install() return self ## # Returns the list of the shared volumes in a NSArray<NSString>. Example: # # [ # @"/Users/jose/Ubuntu One", # @"/Users/jose/Pictures" # ] @objc.typedSelector('v@:') def volumeList(self): d = self.sync_daemon_tool.get_folders() d.addCallback(lambda r: volume_list(r, self.delegate)) return None ## # Returns a NSArray<NSString> whit all the files that are being uploaded. Example: # [ # @"/Users/jose/Ubuntu One/Document.pdf", # @"/Users/jose/Pictures/Image.png" # } @objc.typedSelector('v@:') def currentUploads(self): d = self.sync_daemon_tool.get_current_uploads() d.addCallback(lambda r: get_uploads(r, self.delegate)) return None ## # Like currentUploads() but with the downloads. @objc.typedSelector('v@:') def currentDownloads(self): d = self.sync_daemon_tool.get_current_downloads() d.addCallback(lambda r: get_downloads(r, self.delegate)) return None ## # Indicates if the specified file is public or not. @objc.typedSelector('@@:@') def isFilePublic_(self, filePath): d = self.sync_daemon_tool.get_public_files() d.addCallback(lambda r: file_is_public(r, filePath, self.delegate)) return None ## # Publish or unpublish the specified file. @objc.typedSelector('v@:@B') def changeFile_visibillity_(self, filePath, isPublic): self.sync_daemon_tool.change_public_access(os.path.abspath(filePath), isPublic) return None ## # Returns the link (NSString) of a public file or nil if the file is not public. @objc.typedSelector('@@:@') def getPublicLinkOfFile_(self, filePath): d = self.sync_daemon_tool.get_public_files() d.addCallback(lambda r: get_public_files(r, filePath, self.delegate)) return None ## # Synchronizes the specified folder @objc.typedSelector('@@:@') def synchronizeFolderAtPath_(self, folderPath): d = self.sync_daemon_tool.create_folder(os.path.abspath(folderPath)) d.addCallback(lambda r: folder_synchronized(r, self.delegate)) return None ## # Unsuscribes the specified folder. @objc.typedSelector('@@:@') def unsuscribeFolderAtPath_(self, folderPath): d = self.sync_daemon_tool.get_folders() d.addCallback(lambda r: unsuscribe_volume_list( r, folderPath, self.sync_daemon_tool, self.delegate)) return None
class U1FinderLib(NSObject): ## # Default constructor. @objc.typedSelector('@@:@') def initWithDelegate_(self, delegate): self = super(U1FinderLib, self).init() self.sync_daemon_tool = SyncDaemonTool(None) self.delegate = delegate cfreactor.install() return self ## # Returns the list of the shared volumes in a NSArray<NSString>. Example: # # [ # @"/Users/jose/Ubuntu One", # @"/Users/jose/Pictures" # ] @objc.typedSelector('v@:') def volumeList(self): d = self.sync_daemon_tool.get_folders() d.addCallback(lambda r: volume_list(r, self.delegate)) return None ## # Returns a NSArray<NSString> whit all the files that are being uploaded. Example: # [ # @"/Users/jose/Ubuntu One/Document.pdf", # @"/Users/jose/Pictures/Image.png" # } @objc.typedSelector('v@:') def currentUploads(self): d = self.sync_daemon_tool.get_current_uploads() d.addCallback(lambda r: get_uploads(r, self.delegate)) return None ## # Like currentUploads() but with the downloads. @objc.typedSelector('v@:') def currentDownloads(self): d = self.sync_daemon_tool.get_current_downloads() d.addCallback(lambda r: get_downloads(r, self.delegate)) return None ## # Indicates if the specified file is public or not. @objc.typedSelector('@@:@') def isFilePublic_(self, filePath): d = self.sync_daemon_tool.get_public_files() d.addCallback(lambda r: file_is_public(r, filePath, self.delegate)) return None ## # Publish or unpublish the specified file. @objc.typedSelector('v@:@B') def changeFile_visibillity_(self, filePath, isPublic): self.sync_daemon_tool.change_public_access(os.path.abspath(filePath), isPublic) return None ## # Returns the link (NSString) of a public file or nil if the file is not public. @objc.typedSelector('@@:@') def getPublicLinkOfFile_(self, filePath): d = self.sync_daemon_tool.get_public_files() d.addCallback(lambda r: get_public_files(r, filePath, self.delegate)) return None ## # Synchronizes the specified folder @objc.typedSelector('@@:@') def synchronizeFolderAtPath_(self, folderPath): d = self.sync_daemon_tool.create_folder(os.path.abspath(folderPath)) d.addCallback(lambda r: folder_synchronized(r, self.delegate)) return None ## # Unsuscribes the specified folder. @objc.typedSelector('@@:@') def unsuscribeFolderAtPath_(self, folderPath): d = self.sync_daemon_tool.get_folders() d.addCallback(lambda r: unsuscribe_volume_list(r, folderPath, self.sync_daemon_tool, self.delegate)) return None