Browse Source

better pandac importing for old and new FFI

Joe Shochet 20 years ago
parent
commit
0d5cfa8e1b

+ 0 - 1
direct/src/controls/GravityWalker.py

@@ -18,7 +18,6 @@ from direct.showbase.ShowBaseGlobal import *
 
 
 from direct.directnotify import DirectNotifyGlobal
 from direct.directnotify import DirectNotifyGlobal
 from direct.showbase import DirectObject
 from direct.showbase import DirectObject
-#from pandac import PhysicsManager
 import math
 import math
 
 
 
 

+ 4 - 4
direct/src/directnotify/Notifier.py

@@ -42,8 +42,8 @@ class Notifier:
         delta = int(round(delta))
         delta = int(round(delta))
         Notifier.serverDelta = delta + time.timezone - timezone
         Notifier.serverDelta = delta + time.timezone - timezone
 
 
-        from pandac import NotifyCategory
-        NotifyCategory.NotifyCategory.setServerDelta(self.serverDelta)
+        from pandac.PandaModules import NotifyCategory
+        NotifyCategory.setServerDelta(self.serverDelta)
             
             
         self.info("Notify clock adjusted by %s (and timezone adjusted by %s hours) to synchronize with server." % (PythonUtil.formatElapsedSeconds(delta), (time.timezone - timezone) / 3600))
         self.info("Notify clock adjusted by %s (and timezone adjusted by %s hours) to synchronize with server." % (PythonUtil.formatElapsedSeconds(delta), (time.timezone - timezone) / 3600))
 
 
@@ -72,7 +72,7 @@ class Notifier:
 
 
     # Severity funcs
     # Severity funcs
     def setSeverity(self, severity):
     def setSeverity(self, severity):
-        from pandac import NotifySeverity
+        from pandac.PandaModules import NotifySeverity
         if severity >= NotifySeverity.NSError:
         if severity >= NotifySeverity.NSError:
             self.setWarning(0)
             self.setWarning(0)
             self.setInfo(0)
             self.setInfo(0)
@@ -91,7 +91,7 @@ class Notifier:
             self.setDebug(1)
             self.setDebug(1)
 
 
     def getSeverity(self):
     def getSeverity(self):
-        from pandac import NotifySeverity
+        from pandac.PandaModules import NotifySeverity
         if self.getDebug():
         if self.getDebug():
             return NotifySeverity.NSDebug
             return NotifySeverity.NSDebug
         elif self.getInfo():
         elif self.getInfo():

+ 1 - 7
direct/src/distributed/ServerRepository.py

@@ -5,14 +5,8 @@ from pandac.PandaModules import *
 from direct.distributed.MsgTypes import *
 from direct.distributed.MsgTypes import *
 from direct.task import Task
 from direct.task import Task
 from direct.directnotify import DirectNotifyGlobal
 from direct.directnotify import DirectNotifyGlobal
-#from NetDatagram import NetDatagram
-#from Datagram import Datagram
-#from Datagram import *
-from pandac import Datagram
-from pandac import DatagramIterator
 from direct.distributed.PyDatagram import PyDatagram
 from direct.distributed.PyDatagram import PyDatagram
 from direct.distributed.PyDatagramIterator import PyDatagramIterator
 from direct.distributed.PyDatagramIterator import PyDatagramIterator
-#from PointerToConnection import PointerToConnection
 import time
 import time
 import types
 import types
 
 
@@ -213,7 +207,7 @@ class ServerRepository:
 # switching station for messages
 # switching station for messages
 
 
     def handleDatagram(self, datagram):
     def handleDatagram(self, datagram):
-        dgi = DatagramIterator.DatagramIterator(datagram)
+        dgi = DatagramIterator(datagram)
         type = dgi.getUint16()
         type = dgi.getUint16()
 
 
         if type == CLIENT_DISCONNECT:
         if type == CLIENT_DISCONNECT:

+ 6 - 6
direct/src/ffi/FFIExternalObject.py

@@ -19,8 +19,8 @@ DowncastMap = {}
 # The type map is used for upcasting and downcasting through
 # The type map is used for upcasting and downcasting through
 # the panda inheritance chain
 # the panda inheritance chain
 def registerInTypeMap(pythonClass):
 def registerInTypeMap(pythonClass):
-    from pandac import TypedObject
-    if issubclass(pythonClass, TypedObject.TypedObject):
+    from pandac.PandaModules import TypedObject
+    if issubclass(pythonClass, TypedObject):
         typeIndex = pythonClass.getClassType().getIndex()
         typeIndex = pythonClass.getClassType().getIndex()
         WrapperClassMap[typeIndex] = pythonClass
         WrapperClassMap[typeIndex] = pythonClass
 
 
@@ -210,8 +210,8 @@ class FFIExternalObject:
         # We create a LineStream for the output function to write to, then we extract
         # We create a LineStream for the output function to write to, then we extract
         # the string out of it and return it as our str
         # the string out of it and return it as our str
         try:
         try:
-            from pandac import LineStream
-            lineStream = LineStream.LineStream()
+            from pandac.PandaModules import LineStream
+            lineStream = LineStream()
             self.output(lineStream)
             self.output(lineStream)
             baseRepr = lineStream.getLine()
             baseRepr = lineStream.getLine()
         except AssertionError, e:
         except AssertionError, e:
@@ -229,8 +229,8 @@ class FFIExternalObject:
         # Lots of Panda classes have an write or output function defined that takes an Ostream
         # Lots of Panda classes have an write or output function defined that takes an Ostream
         # We create a LineStream for the write or output function to write to, then we extract
         # We create a LineStream for the write or output function to write to, then we extract
         # the string out of it and return it as our repr
         # the string out of it and return it as our repr
-        from pandac import LineStream
-        lineStream = LineStream.LineStream()
+        from pandac.PandaModules import LineStream
+        lineStream = LineStream()
         try:
         try:
             # First try the write function, that is the better one
             # First try the write function, that is the better one
             self.write(lineStream)
             self.write(lineStream)

+ 0 - 1
direct/src/particles/ForceGroup.py

@@ -2,7 +2,6 @@ from pandac.PandaModules import *
 from direct.showbase.DirectObject import *
 from direct.showbase.DirectObject import *
 from direct.showbase.PhysicsManagerGlobal import *
 from direct.showbase.PhysicsManagerGlobal import *
 
 
-#from pandac import ForceNode
 from direct.directnotify import DirectNotifyGlobal
 from direct.directnotify import DirectNotifyGlobal
 import sys
 import sys
 
 

+ 2 - 2
direct/src/task/Task.py

@@ -138,8 +138,8 @@ class Task:
 
 
     def setupPStats(self, name):
     def setupPStats(self, name):
         if __debug__ and TaskManager.taskTimerVerbose:
         if __debug__ and TaskManager.taskTimerVerbose:
-            from pandac import PStatCollector
-            self.pstats = PStatCollector.PStatCollector("App:Show code:" + name)
+            from pandac.PandaModules import PStatCollector
+            self.pstats = PStatCollector("App:Show code:" + name)
 
 
     def finishTask(self, verbose):
     def finishTask(self, verbose):
         if hasattr(self, "uponDeath"):
         if hasattr(self, "uponDeath"):

+ 2 - 3
direct/src/tkpanels/NotifyPanel.py

@@ -12,8 +12,8 @@ class NotifyPanel:
         from direct.showbase.TkGlobal import Pmw, Toplevel, Frame, Label , Radiobutton
         from direct.showbase.TkGlobal import Pmw, Toplevel, Frame, Label , Radiobutton
         from direct.showbase.TkGlobal import HORIZONTAL, X, W, NW, BOTH, LEFT, RIGHT, IntVar
         from direct.showbase.TkGlobal import HORIZONTAL, X, W, NW, BOTH, LEFT, RIGHT, IntVar
         # To get severity levels
         # To get severity levels
-        from pandac.NotifySeverity import NSFatal, NSError, NSWarning, NSInfo
-        from pandac.NotifySeverity import NSDebug, NSSpam
+        from pandac.PandaModules import NSFatal, NSError, NSWarning, NSInfo
+        from pandac.PandaModules import NSDebug, NSSpam
 
 
         if tl == None:
         if tl == None:
             tl = Toplevel()
             tl = Toplevel()
@@ -29,7 +29,6 @@ class NotifyPanel:
         categoryFrame = framePane.add('categories', size = 200)
         categoryFrame = framePane.add('categories', size = 200)
         severityFrame = framePane.add('severities', size = 50)
         severityFrame = framePane.add('severities', size = 50)
         # Category frame
         # Category frame
-        from pandac import NotifyCategory
         # Assemble PANDA categories
         # Assemble PANDA categories
         categories = self.getPandaCategoriesAsList()
         categories = self.getPandaCategoriesAsList()
         self.__categories = {}
         self.__categories = {}