Panda3D
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties
Classes | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
PackageInstaller Class Reference
Inheritance diagram for PackageInstaller:
DirectObject DWBPackageInstaller

Classes

class  PendingPackage
 

Public Member Functions

def __init__
 
def addPackage
 
def cleanup
 
def destroy
 
def donePackages
 
def downloadFinished
 
def downloadProgress
 
def downloadStarted
 
def packageFinished
 
def packageProgress
 
def packageStarted
 
- Public Member Functions inherited from DirectObject
def __init__
 
def accept
 
def acceptOnce
 
def addTask
 
def detectLeaks
 
def doMethodLater
 
def getAllAccepting
 
def ignore
 
def ignoreAll
 
def isAccepting
 
def isIgnoring
 
def removeAllTasks
 
def removeTask
 

Public Attributes

 appRunner
 
 callbackLock
 
 calledDownloadFinished
 
 calledDownloadStarted
 
 descFileTask
 
 done
 
 downloadTask
 
 earlyDone
 
 failed
 
 needsDescFile
 
 needsDownload
 
 packageLock
 
 packages
 
 progressTask
 
 state
 
 taskChain
 
 uniqueId
 

Static Public Attributes

tuple globalLock = Lock()
 
int nextUniqueId = 1
 
tuple notify = directNotify.newCategory("PackageInstaller")
 
int S_done = 3
 
int S_initial = 0
 
int S_ready = 1
 
int S_started = 2
 

Detailed Description

This class is used in a p3d runtime environment to manage the
asynchronous download and installation of packages.  If you just
want to install a package synchronously, see
appRunner.installPackage() for a simpler interface.

To use this class, you should subclass from it and override any of
the six callback methods: downloadStarted(), packageStarted(),
packageProgress(), downloadProgress(), packageFinished(),
downloadFinished().

Also see DWBPackageInstaller, which does exactly this, to add a
DirectWaitBar GUI.

Constructor & Destructor Documentation

def __init__ (   self,
  appRunner,
  taskChain = 'default' 
)

Member Function Documentation

def addPackage (   self,
  packageName,
  version = None,
  hostUrl = None 
)
Adds the named package to the list of packages to be
downloaded.  Call donePackages() to finish the list. 
def cleanup (   self)
Interrupts all pending downloads.  No further callbacks
will be made. 
def destroy (   self)
Interrupts all pending downloads.  No further callbacks
will be made. 
def donePackages (   self)
After calling addPackage() for each package to be
installed, call donePackages() to mark the end of the list.
This is necessary to determine what the complete set of
packages is (and therefore how large the total download size
is).  None of the low-level callbacks will be made before this
call. 
def downloadFinished (   self,
  success 
)
This callback is made when all of the packages have been
downloaded and installed (or there has been some failure).  If
all packages where successfully installed, success is True.

If there were no packages that required downloading, this
callback will be made immediately, *without* a corresponding
call to downloadStarted(). 
def downloadProgress (   self,
  overallProgress 
)
This callback is made repeatedly between downloadStarted()
and downloadFinished() to update the current progress through
all packages.  The progress value ranges from 0 (beginning) to
1 (complete). 
def downloadStarted (   self)
This callback is made at some point after donePackages()
is called; at the time of this callback, the total download
size is known, and we can sensibly report progress through the
whole. 
def packageFinished (   self,
  package,
  success 
)
This callback is made for each package between
downloadStarted() and downloadFinished() to indicate that a
package has finished downloading.  If success is true, there
were no problems and the package is now installed.

If this package did not require downloading (because it was
already downloaded), this callback will be made immediately,
*without* a corresponding call to packageStarted(), and may
even be made before downloadStarted(). 
def packageProgress (   self,
  package,
  progress 
)
This callback is made repeatedly between packageStarted()
and packageFinished() to update the current progress on the
indicated package only.  The progress value ranges from 0
(beginning) to 1 (complete). 
def packageStarted (   self,
  package 
)
This callback is made for each package between
downloadStarted() and downloadFinished() to indicate the start
of a new package. 

Member Data Documentation

appRunner
callbackLock
calledDownloadFinished
calledDownloadStarted
descFileTask
done
downloadTask
earlyDone
failed
tuple globalLock = Lock()
static
needsDescFile
needsDownload
int nextUniqueId = 1
static
tuple notify = directNotify.newCategory("PackageInstaller")
static
packageLock
packages
progressTask
int S_done = 3
static
int S_initial = 0
static
int S_ready = 1
static
int S_started = 2
static
state
taskChain
uniqueId