Get rid of assertion warning

This commit is contained in:
Mark Mine 2003-02-05 01:50:00 +00:00
parent 97711d14d9
commit 5c52580edd
2 changed files with 20 additions and 13 deletions

View File

@ -849,15 +849,22 @@ class DisplayRegionContext(PandaObject):
else: else:
self.camLens.setFov(hfov, vfov) self.camLens.setFov(hfov, vfov)
def getWidth(self):
prop = base.win.getProperties()
if prop.hasSize():
return prop.getXSize()
else:
return 640
def getHeight(self):
prop = base.win.getProperties()
if prop.hasSize():
return prop.getYSize()
else:
return 480
def camUpdate(self, lens = None): def camUpdate(self, lens = None):
# Window Data # Window Data
prop = base.win.getProperties()
try:
self.width = prop.getXSize()
self.height = prop.getYSize()
except AssertionError:
self.width = 640
self.height = 480
self.near = self.camLens.getNear() self.near = self.camLens.getNear()
self.far = self.camLens.getFar() self.far = self.camLens.getFar()
self.fovH = self.camLens.getHfov() self.fovH = self.camLens.getHfov()

View File

@ -3414,7 +3414,7 @@ class LevelStyleManager:
keys.sort() keys.sort()
styles = map(lambda x, d = dictionary: d[x], keys) styles = map(lambda x, d = dictionary: d[x], keys)
sf = 0.1 sf = 0.1
aspectRatio = (direct.dr.width/float(direct.dr.height)) aspectRatio = (direct.dr.getWidth()/float(direct.dr.getHeight()))
for i in range(numItems): for i in range(numItems):
# Get the node # Get the node
node = self.createBaselineStyleSample(styles[i]) node = self.createBaselineStyleSample(styles[i])
@ -3537,7 +3537,7 @@ class LevelStyleManager:
keys.sort() keys.sort()
styles = map(lambda x, d = dictionary: d[x], keys) styles = map(lambda x, d = dictionary: d[x], keys)
sf = 0.03 sf = 0.03
aspectRatio = (direct.dr.width/float(direct.dr.height)) aspectRatio = (direct.dr.getWidth()/float(direct.dr.getHeight()))
for i in range(numItems): for i in range(numItems):
# Get the node # Get the node
node = self.createWallStyleSample(styles[i]) node = self.createWallStyleSample(styles[i])
@ -3739,7 +3739,7 @@ class LevelStyleManager:
keys.sort() keys.sort()
styles = map(lambda x, d = dictionary: d[x], keys) styles = map(lambda x, d = dictionary: d[x], keys)
sf = 0.02 sf = 0.02
aspectRatio = (direct.dr.width/float(direct.dr.height)) aspectRatio = (direct.dr.getWidth()/float(direct.dr.getHeight()))
for i in range(numItems): for i in range(numItems):
# Get the node # Get the node
node = self.createBuildingStyleSample(styles[i]) node = self.createBuildingStyleSample(styles[i])
@ -3952,7 +3952,7 @@ class LevelStyleManager:
newColorMenu = hidden.attachNewNode(menuName + 'Menu') newColorMenu = hidden.attachNewNode(menuName + 'Menu')
# Compute the angle per item # Compute the angle per item
angle = deg2Rad(360.0/float(numItems)) angle = deg2Rad(360.0/float(numItems))
aspectRatio = (direct.dr.width / float(direct.dr.height)) aspectRatio = (direct.dr.getWidth() / float(direct.dr.getHeight()))
# Attach the color chips to the new menu and adjust sizes # Attach the color chips to the new menu and adjust sizes
for i in range (numItems): for i in range (numItems):
# Create a text node--just a card, really--of the right color. # Create a text node--just a card, really--of the right color.
@ -4034,7 +4034,7 @@ class LevelStyleManager:
newMenu = hidden.attachNewNode(dnaType + 'Menu') newMenu = hidden.attachNewNode(dnaType + 'Menu')
# Compute angle increment per item # Compute angle increment per item
angle = deg2Rad(360.0/numItems) angle = deg2Rad(360.0/numItems)
aspectRatio = direct.dr.width /float(direct.dr.height) aspectRatio = direct.dr.getWidth() /float(direct.dr.getHeight())
# Add items # Add items
for i in range(0, numItems): for i in range(0, numItems):
if dnaList[i]: if dnaList[i]:
@ -4069,7 +4069,7 @@ class LevelStyleManager:
newMenu = hidden.attachNewNode(dnaType + 'Menu') newMenu = hidden.attachNewNode(dnaType + 'Menu')
# Compute angle per item # Compute angle per item
angle = deg2Rad(360.0/numItems) angle = deg2Rad(360.0/numItems)
aspectRatio = direct.dr.width/float(direct.dr.height) aspectRatio = direct.dr.getWidth()/float(direct.dr.getHeight())
# Add items # Add items
for i in range (numItems): for i in range (numItems):
# Create text node for each item # Create text node for each item