Panda3D
Loading...
Searching...
No Matches
PackageInstaller Class Reference
Inheritance diagram for PackageInstaller:
DirectObject DWBPackageInstaller

Classes

class  PendingPackage
 

Public Member Functions

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

Public Attributes

 appRunner = appRunner
 
 callbackLock = Lock()
 
bool calledDownloadFinished = False
 
bool calledDownloadStarted = False
 
 descFileTask = None
 
list done = []
 
 downloadTask = None
 
list earlyDone = []
 
list failed = []
 
list needsDescFile = []
 
list needsDownload = []
 
 packageLock = RLock()
 
list packages = []
 
 progressTask = None
 
int state = self.S_initial
 
 taskChain = taskChain
 
int uniqueId = PackageInstaller.nextUniqueId
 

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
 accept_once = acceptOnce
 
 add_task = addTask
 
 detect_leaks = detectLeaks
 
 do_method_later = doMethodLater
 
 get_all_accepting = getAllAccepting
 
 ignore_all = ignoreAll
 
 is_accepting = isAccepting
 
 is_ignoring = isIgnoring
 
 remove_all_tasks = removeAllTasks
 
 remove_task = removeTask
 

Additional Inherited Members

- Protected Member Functions inherited from DirectObject
 _addTask (self, task)
 
 _clearTask (self, task)
 
- Protected Attributes inherited from DirectObject
dict _taskList = {}
 

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

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

Member Function Documentation

◆ addPackage()

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

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

Reimplemented in DWBPackageInstaller.

◆ destroy()

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

Reimplemented in DWBPackageInstaller.

◆ donePackages()

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

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

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

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

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

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

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 = appRunner

◆ callbackLock

callbackLock = Lock()

◆ calledDownloadFinished

bool calledDownloadFinished = False

◆ calledDownloadStarted

bool calledDownloadStarted = False

◆ descFileTask

descFileTask = None

◆ done

list done = []

◆ downloadTask

downloadTask = None

◆ earlyDone

list earlyDone = []

◆ failed

list failed = []

◆ globalLock

globalLock = Lock()
static

◆ needsDescFile

list needsDescFile = []

◆ needsDownload

list needsDownload = []

◆ nextUniqueId

int nextUniqueId = 1
static

◆ notify

notify = directNotify.newCategory("PackageInstaller")
static

◆ packageLock

packageLock = RLock()

◆ packages

list packages = []

◆ progressTask

progressTask = None

◆ 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

int state = self.S_initial

◆ taskChain

taskChain = taskChain

◆ uniqueId