Panda3D
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__ (self, appRunner, taskChain='default')
 
def addPackage (self, packageName, version=None, hostUrl=None)
 
def cleanup (self)
 
def destroy (self)
 
def donePackages (self)
 
def downloadFinished (self, success)
 
def downloadProgress (self, overallProgress)
 
def downloadStarted (self)
 
def packageFinished (self, package, success)
 
def packageProgress (self, package, progress)
 
def packageStarted (self, package)
 
- Public Member Functions inherited from DirectObject
def __init__ (self)
 
def accept (self, event, method, extraArgs=[])
 
def acceptOnce (self, event, method, extraArgs=[])
 
def addTask (self, *args, **kwargs)
 
def detectLeaks (self)
 
def doMethodLater (self, *args, **kwargs)
 
def getAllAccepting (self)
 
def ignore (self, event)
 
def ignoreAll (self)
 
def isAccepting (self, event)
 
def isIgnoring (self, event)
 
def removeAllTasks (self)
 
def removeTask (self, taskOrName)
 

Public Attributes

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

Static Public Attributes

 globalLock = Lock()
 
int nextUniqueId = 1
 
 notify = directNotify.newCategory("PackageInstaller")
 
int S_done = 3
 
int S_initial = 0
 
int S_ready = 1
 
int S_started = 2
 
- Static Public Attributes inherited from DirectObject
def accept_once = acceptOnce
 
def add_task = addTask
 
def detect_leaks = detectLeaks
 
def do_method_later = doMethodLater
 
def get_all_accepting = getAllAccepting
 
def ignore_all = ignoreAll
 
def is_accepting = isAccepting
 
def is_ignoring = isIgnoring
 
def remove_all_tasks = removeAllTasks
 
def remove_task = removeTask
 

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

◆ __init__()

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

Member Function Documentation

◆ addPackage()

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. 

◆ cleanup()

def cleanup (   self)
Interrupts all pending downloads.  No further callbacks
will be made. 

Reimplemented in DWBPackageInstaller.

◆ destroy()

def destroy (   self)
Interrupts all pending downloads.  No further callbacks
will be made. 

Reimplemented in DWBPackageInstaller.

◆ donePackages()

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. 

◆ downloadFinished()

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(). 

Reimplemented in DWBPackageInstaller.

◆ downloadProgress()

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). 

Reimplemented in DWBPackageInstaller.

◆ downloadStarted()

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. 

◆ packageFinished()

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(). 

◆ packageProgress()

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). 

Reimplemented in DWBPackageInstaller.

◆ packageStarted()

def packageStarted (   self,
  package 
)
This callback is made for each package between
downloadStarted() and downloadFinished() to indicate the start
of a new package. 

Reimplemented in DWBPackageInstaller.

Member Data Documentation

◆ appRunner

appRunner

◆ callbackLock

callbackLock

◆ calledDownloadFinished

calledDownloadFinished

◆ calledDownloadStarted

calledDownloadStarted

◆ descFileTask

descFileTask

◆ done

done

◆ downloadTask

downloadTask

◆ earlyDone

earlyDone

◆ failed

failed

◆ globalLock

globalLock = Lock()
static

◆ needsDescFile

needsDescFile

◆ needsDownload

needsDownload

◆ nextUniqueId

int nextUniqueId = 1
static

◆ notify

notify = directNotify.newCategory("PackageInstaller")
static

◆ packageLock

packageLock

◆ packages

packages

◆ progressTask

progressTask

◆ S_done

int S_done = 3
static

◆ S_initial

int S_initial = 0
static

◆ S_ready

int S_ready = 1
static

◆ S_started

int S_started = 2
static

◆ state

state

◆ taskChain

taskChain

◆ uniqueId

uniqueId