panda3d.core.ConfigPage

class ConfigPage

A page of ConfigDeclarations that may be loaded or unloaded. Typically this represents a single .prc file that is read from disk at runtime, but it may also represent a list of declarations built up by application code and explicitly loaded.

Inheritance diagram

Inheritance diagram of ConfigPage

clear() → None

Removes all of the declarations from the page.

property declarations

Returns a modifiable pointer to the nth declaration on the page. Any modifications will appear in the output, if the page is written out with ConfigPage.write().

Return type

Sequence[ConfigDeclaration]

deleteDeclaration(decl: ConfigDeclaration) → bool

Removes the indicated declaration from the page and deletes it. Returns true if the declaration is successfully removed, false if it was not on the page.

getDeclaration(n: size_t) → ConfigDeclaration

Returns the nth declaration on the page.

Return type

ConfigDeclaration

static getDefaultPage() → ConfigPage

Returns a pointer to the global “default page”. This is the ConfigPage that lists all variables’ original default values.

Return type

ConfigPage

static getLocalPage() → ConfigPage

Returns a pointer to the global “local page”. This is the ConfigPage that lists the locally-assigned values for any variables in the world that have such a local assignment.

Return type

ConfigPage

getName() → str

Returns the name of the page. If the page was loaded from a .prc file, this is usually the filename.

getNumDeclarations() → size_t

Returns the number of declarations on the page.

Return type

size_t

getPageSeq() → int

Returns the sequence number of the page.

Sequence numbers for a particular class (implicit vs. explicit) of pages are assigned as each page is loaded; each page is given a higher sequence number than all the pages loaded before it.

The implicit_load pages, which are discovered in the file system automatically, have a different set of sequence numbers than the explicit pages.

getSignature() → str

Returns the raw binary signature that was found in the prc file, if any. This method is probably not terribly useful for most applications.

getSort() → int

Returns the explicit sort order of this particular ConfigPage. See setSort().

getStringValue(n: size_t) → str

Returns the value assigned by the nth declaration on the page.

getTrustLevel() → int

Returns the trust level associated with this page. An untrusted page is trust level 0; if the page was loaded from a signed .prc file, its trust level is the index number of the certificate that signed it. Generally, a higher trust level value represents a greater level of trust.

getVariableName(n: size_t) → str

Returns the variable named by the nth declaration on the page.

property implicit

Returns true if the page was loaded by implicitly searching the config path on startup, or false if it was explicitly loaded by dynamic code after initial startup.

Return type

bool

isImplicit() → bool

Returns true if the page was loaded by implicitly searching the config path on startup, or false if it was explicitly loaded by dynamic code after initial startup.

isSpecial() → bool

Returns true if this is the special “default” or “local” page, or false if it is an ordinary page, e.g. an implicit page loaded from a prc file at startup, or an explicit page created by ConfigPageManager.makeExplicitPage().

isVariableUsed(n: size_t) → bool

Returns true if the nth active variable on the page has been used by code, false otherwise.

makeDeclaration(variable: ConfigVariableCore, value: str) → ConfigDeclaration

Adds the indicated variable/value pair as a new declaration on the page.

Return type

ConfigDeclaration

makeDeclaration(variable: str, value: str) → ConfigDeclaration

Adds the indicated variable/value pair as a new declaration on the page.

Return type

ConfigDeclaration

modifyDeclaration(n: size_t) → ConfigDeclaration

Returns a modifiable pointer to the nth declaration on the page. Any modifications will appear in the output, if the page is written out with ConfigPage.write().

Return type

ConfigDeclaration

property name

Returns the name of the page. If the page was loaded from a .prc file, this is usually the filename.

Return type

string

output(out: ostream) → None
outputBriefSignature(out: ostream) → None

Outputs the first few hex digits of the signature.

property page_seq

Returns the sequence number of the page.

Sequence numbers for a particular class (implicit vs. explicit) of pages are assigned as each page is loaded; each page is given a higher sequence number than all the pages loaded before it.

The implicit_load pages, which are discovered in the file system automatically, have a different set of sequence numbers than the explicit pages.

Return type

int

readEncryptedPrc(in: istream, password: str) → bool

Automatically decrypts and reads the stream, given the indicated password. Note that if the password is incorrect, the result may be garbage.

readPrc(in: istream) → bool

Reads the contents of a complete prc file, as returned by the indicated istream, into the current page file. Returns true on success, or false on some I/O error.

This is a low-level interface. Normally you do not need to call it directly. See the global functions loadPrcFile() and un:meth:~loadPrcFile, defined in panda/src/putil, for a higher-level interface.

setSort(sort: int) → None

Changes the explicit sort order of this particular ConfigPage. Lower- numbered pages supercede higher-numbered pages. Initially, all explicitly- loaded pages have sort value 0, and implicitly-loaded pages (found on disk) have sort value 10; you may set an individual page higher or lower to influence its priority relative to other pages.

setTrustLevel(trust_level: int) → None

Explicitly sets the trust level on this particular page. Note that any subsequent changes to the page, or to any variable declarations on it, will reset the trust level to zero.

property signature

Returns the raw binary signature that was found in the prc file, if any. This method is probably not terribly useful for most applications.

Return type

string

property sort
Getter

Returns the explicit sort order of this particular ConfigPage. See setSort().

Setter

Changes the explicit sort order of this particular ConfigPage. Lower- numbered pages supercede higher-numbered pages. Initially, all explicitly- loaded pages have sort value 0, and implicitly-loaded pages (found on disk) have sort value 10; you may set an individual page higher or lower to influence its priority relative to other pages.

Return type

int

property special

Returns true if this is the special “default” or “local” page, or false if it is an ordinary page, e.g. an implicit page loaded from a prc file at startup, or an explicit page created by ConfigPageManager.makeExplicitPage().

Return type

bool

property trust_level
Getter

Returns the trust level associated with this page. An untrusted page is trust level 0; if the page was loaded from a signed .prc file, its trust level is the index number of the certificate that signed it. Generally, a higher trust level value represents a greater level of trust.

Setter

Explicitly sets the trust level on this particular page. Note that any subsequent changes to the page, or to any variable declarations on it, will reset the trust level to zero.

Return type

int

write(out: ostream) → None