*** empty log message ***

This commit is contained in:
Joe Shochet 2001-05-16 18:31:20 +00:00
parent 54b6ff6a5c
commit e134c8bb13
5 changed files with 21 additions and 26 deletions

View File

@ -698,9 +698,9 @@ class DisplayRegionContext:
self.mouseLastY = self.mouseY
# Values for this frame
# This ranges from -1 to 1
if (base.mouseWatcher.node().hasMouse()):
self.mouseX = base.mouseWatcher.node().getMouseX()
self.mouseY = base.mouseWatcher.node().getMouseY()
if (base.mouseWatcherNode.hasMouse()):
self.mouseX = base.mouseWatcherNode.getMouseX()
self.mouseY = base.mouseWatcherNode.getMouseY()
# Delta percent of window the mouse moved
self.mouseDeltaX = self.mouseX - self.mouseLastX
self.mouseDeltaY = self.mouseY - self.mouseLastY

View File

@ -84,7 +84,6 @@ class FFIExternalObject:
fromClass = lineage[top - i]
downcastFuncName = ('downcastTo' + toClass.__name__
+ 'From' + fromClass.__name__)
print downcastFuncName
# Look over this classes global modules dictionaries
# for the downcast function name
for globmod in toClass.__CModuleDowncasts__:
@ -99,7 +98,12 @@ class FFIExternalObject:
def setPointer(self):
# See what type it really is and downcast to that type (if necessary)
# Look up the TypeHandle in the dict. get() returns None if it is not there
exactWrapperClass = WrapperClassMap.get(self.getType().getIndex())
try:
index = self.getTypeIndex()
except:
# Remove this after everybody builds their panda
index = self.getType().getIndex()
exactWrapperClass = WrapperClassMap.get(index)
# We do not need to downcast if we already have the same class
if (exactWrapperClass and (exactWrapperClass != self.__class__)):
# Create a new wrapper class instance

View File

@ -221,7 +221,7 @@ class OnscreenPanel(PandaObject.PandaObject, NodePath):
button.func, [button.button])
button.startBehavior()
base.mouseWatcher.node().addRegion(self.panelRegion)
base.mouseWatcherNode.addRegion(self.panelRegion)
def hide(self):
"""hide(self):
@ -241,7 +241,7 @@ class OnscreenPanel(PandaObject.PandaObject, NodePath):
if button.panelManage:
button.unmanage()
base.mouseWatcher.node().removeRegion(self.panelRegion)
base.mouseWatcherNode.removeRegion(self.panelRegion)
def makeButton(self, name,
func = None,

View File

@ -12,13 +12,10 @@ class EventManager:
"""
Create a C++ event queue and handler
"""
# Make a notify category for this class (unless there already is one)
if (EventManager.notify == None):
EventManager.notify = directNotify.newCategory("EventManager")
# EventManager.notify.setDebug(1)
self.eventQueue = EventQueue.getGlobalEventQueue()
self.eventHandler = EventHandler(self.eventQueue)
@ -27,8 +24,7 @@ class EventManager:
Process all the events on the C++ event queue
"""
while (not self.eventQueue.isQueueEmpty()):
event = self.eventQueue.dequeueEvent()
self.processEvent(event)
self.processEvent(self.eventQueue.dequeueEvent())
return Task.cont
def parseEventParameter(self, eventParameter):
@ -46,36 +42,28 @@ class EventManager:
else:
return eventParameter.getPtr()
def processEvent(self, event):
"""
Process a C++ event
"""
# If the event has a name, throw a Python event with the Pythonified name
if event.hasName():
# Get the event name
eventName = event.getName()
numParameters = event.getNumParameters()
# Get the event name
eventName = event.getName()
if eventName:
paramList = []
for i in range(numParameters):
for i in range(event.getNumParameters()):
eventParameter = event.getParameter(i)
eventParameterData = self.parseEventParameter(eventParameter)
paramList.append(eventParameterData)
# Do not print the new frame debug, it is too noisy!
if (eventName != 'NewFrame'):
EventManager.notify.debug('received C++ event named: ' + eventName +
' parameters: ' + `paramList`)
# Send the event, we used to send it with the event
# name as a parameter, but now you can use extraArgs for that
if paramList:
messenger.send(eventName, paramList)
else:
messenger.send(eventName)
# Also send the event down into C++ land
self.eventHandler.dispatchEvent(event)

View File

@ -85,7 +85,9 @@ class ShowBase:
self.camList.append( camera.find('**/+Camera') )
# Set the default camera
self.cam = self.camera.find('**/+Camera')
# If you need to use the camera node, use camNode instead
# of calling cam.node() to save the FFI overhead
self.camNode = self.cam.node()
# Set up a 2-d layer for drawing things behind Gui labels.
self.render2d = NodePath(setupPanda2d(self.win, "render2d"))
@ -128,7 +130,8 @@ class ShowBase:
# mouseWatcher, while objects that want events in all cases, like the
# chat interface, should be parented to mak.
self.mak = self.dataRoot.attachNewNode(MouseAndKeyboard(self.win, 0, 'mak'))
self.mouseWatcher = self.mak.attachNewNode(MouseWatcher('mouseWatcher'))
self.mouseWatcherNode = MouseWatcher('mouseWatcher')
self.mouseWatcher = self.mak.attachNewNode(self.mouseWatcherNode)
# We also create a DataValve object above the trackball/drive
# interface, which will allow us to switch some of the mouse