def cwd(self, arg=None, menuw=None): """ make a menu item for each file in the directory """ items = [] parentPath = self.path if len(parentPath) == 1: parentPath = "" print "cwd for" + parentPath # Append Folders folders = pygphoto.gp_getsubfolders( self.gCamera, self.path ) number = pygphoto.gp_list_count( folders ) while number > 0: number = number - 1 name = pygphoto.gp_name( folders, number ) subFolder = CameraFolder( self, self.gCamera, parentPath + "/" + name, name ) items.append( subFolder ) files = pygphoto.gp_getfiles( self.gCamera, self.path ) number = pygphoto.gp_list_count( files ) while number > 0: number = number - 1 name = pygphoto.gp_name( files, number ) subFile = CameraFile( self, self.gCamera, parentPath, name ) items.append( subFile ) item_menu = menu.Menu(self.name, items) menuw.pushmenu(item_menu) return items
def detectCameras(self): gplist = pygphoto.gp_detectcameras( ) count = pygphoto.gp_list_count( gplist ) list = [] while count > 0: count = count - 1 list.append( [pygphoto.gp_name(gplist, count),pygphoto.gp_value(gplist,count)] ) return list