general: loads to connecting screen on python 3.x

This commit is contained in:
John Cote 2019-12-30 01:59:01 -05:00
parent 3c14c14623
commit a79b2dff0b
28 changed files with 70 additions and 74 deletions

View file

@ -1,5 +1,5 @@
from movement.CImpulse import CImpulse from .movement.CImpulse import CImpulse
from movement.CMover import CMover from .movement.CMover import CMover
from movement.CMoverGroup import CMoverGroup from .movement.CMoverGroup import CMoverGroup
from nametag import * from .nametag import *
from settings.Settings import Settings from .settings.Settings import Settings

View file

@ -64,7 +64,7 @@ class CMover:
self.dt = clockDelta - self.dtClock self.dt = clockDelta - self.dtClock
self.dtClock = clockDelta self.dtClock = clockDelta
for cImpulse in self.cImpulses.values(): for cImpulse in list(self.cImpulses.values()):
cImpulse.process(self.getDt()) cImpulse.process(self.getDt())
def addShove(self, shove): def addShove(self, shove):

View file

@ -37,6 +37,6 @@ class CMoverGroup:
self.dt = clockDelta - self.dtClock self.dt = clockDelta - self.dtClock
self.dtClock = clockDelta self.dtClock = clockDelta
for cMover in self.cMovers.values(): for cMover in list(self.cMovers.values()):
cMover.processCImpulses(self.dt) cMover.processCImpulses(self.dt)
cMover.integrate() cMover.integrate()

View file

@ -1,7 +1,7 @@
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from panda3d.core import * from panda3d.core import *
import NametagGlobals from . import NametagGlobals
class ChatBalloon: class ChatBalloon:
@ -30,7 +30,7 @@ class ChatBalloon:
if node.isGeomNode(): if node.isGeomNode():
return node return node
for i in xrange(node.getNumChildren()): for i in range(node.getNumChildren()):
n = ChatBalloon.find_geom_node(node.getChild(i)) n = ChatBalloon.find_geom_node(node.getChild(i))
if n: if n:
return n return n
@ -43,7 +43,7 @@ class ChatBalloon:
return None return None
child = None child = None
for i in xrange(node.getNumChildren()): for i in range(node.getNumChildren()):
child = node.getChild(i) child = node.getChild(i)
if child.getName() == 'middle': if child.getName() == 'middle':
return n return n
@ -58,7 +58,7 @@ class ChatBalloon:
if node.getName() == 'chatBalloon': if node.getName() == 'chatBalloon':
return self.scan_balloon(node) return self.scan_balloon(node)
for i in xrange(node.getNumChildren()): for i in range(node.getNumChildren()):
if self.scan(node.getChild(i)): if self.scan(node.getChild(i)):
return True return True
@ -67,7 +67,7 @@ class ChatBalloon:
def scan_balloon(self, node): def scan_balloon(self, node):
self.m_copy_node = node.copySubgraph() self.m_copy_node = node.copySubgraph()
for i in xrange(node.getNumChildren()): for i in range(node.getNumChildren()):
child = node.getChild(i) child = node.getChild(i)
if child.getName() == 'top': if child.getName() == 'top':
self.m_top_node = child self.m_top_node = child

View file

@ -1,7 +1,7 @@
from direct.showbase.DirectObject import DirectObject from direct.showbase.DirectObject import DirectObject
from panda3d.core import * from panda3d.core import *
import NametagGlobals from . import NametagGlobals
class PopupMouseWatcherRegion(MouseWatcherRegion): class PopupMouseWatcherRegion(MouseWatcherRegion):

View file

@ -154,7 +154,7 @@ class MarginManager(PandaNode):
if cell.m_available and not cell.m_np: if cell.m_available and not cell.m_np:
cells.append(i) cells.append(i)
for handle in self.m_popups.values(): for handle in list(self.m_popups.values()):
v7 = handle.m_popup v7 = handle.m_popup
if handle.m_wants_visible and not v7.isVisible(): if handle.m_wants_visible and not v7.isVisible():
v8 = self.chooseCell(v7, cells) v8 = self.chooseCell(v7, cells)
@ -163,7 +163,7 @@ class MarginManager(PandaNode):
def showVisibleResolveConflict(self): def showVisibleResolveConflict(self):
v4 = [] v4 = []
for handle in self.m_popups.values(): for handle in list(self.m_popups.values()):
score = 0 score = 0
if handle.m_wants_visible: if handle.m_wants_visible:
score = handle.m_score score = handle.m_score
@ -190,7 +190,7 @@ class MarginManager(PandaNode):
def update(self): def update(self):
num_want_visible = 0 num_want_visible = 0
for handle in self.m_popups.values(): for handle in list(self.m_popups.values()):
popup = handle.m_popup popup = handle.m_popup
handle.m_wants_visible = popup.considerVisible() handle.m_wants_visible = popup.considerVisible()
if handle.m_wants_visible and handle.m_objcode: if handle.m_wants_visible and handle.m_objcode:
@ -207,5 +207,5 @@ class MarginManager(PandaNode):
else: else:
self.showVisibleNoConflict() self.showVisibleNoConflict()
for popup in self.m_popups.keys(): for popup in list(self.m_popups.keys()):
popup.frameCallback() popup.frameCallback()

View file

@ -1,6 +1,6 @@
from panda3d.core import * from panda3d.core import *
import NametagGlobals from . import NametagGlobals
class MarginPopup(PandaNode): class MarginPopup(PandaNode):

View file

@ -1,7 +1,7 @@
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from ClickablePopup import * from .ClickablePopup import *
from _constants import * from ._constants import *
class Nametag(ClickablePopup): class Nametag(ClickablePopup):

View file

@ -2,10 +2,10 @@ import math
from panda3d.core import * from panda3d.core import *
import NametagGlobals from . import NametagGlobals
from MarginPopup import MarginPopup from .MarginPopup import MarginPopup
from Nametag import Nametag from .Nametag import Nametag
from _constants import * from ._constants import *
class Nametag2d(Nametag, MarginPopup): class Nametag2d(Nametag, MarginPopup):
@ -74,7 +74,7 @@ class Nametag2d(Nametag, MarginPopup):
return np.getPos(NametagGlobals._toon).lengthSquared() return np.getPos(NametagGlobals._toon).lengthSquared()
def considerVisible(self): def considerVisible(self):
from NametagGroup import NametagGroup from .NametagGroup import NametagGroup
v2 = 0 v2 = 0
do_update = True do_update = True

View file

@ -2,9 +2,9 @@ import math
from panda3d.core import * from panda3d.core import *
import NametagGlobals from . import NametagGlobals
from Nametag import Nametag from .Nametag import Nametag
from _constants import * from ._constants import *
class Nametag3d(Nametag, PandaNode): class Nametag3d(Nametag, PandaNode):

View file

@ -1,4 +1,4 @@
from Nametag3d import Nametag3d from .Nametag3d import Nametag3d
class NametagFloat2d(Nametag3d): class NametagFloat2d(Nametag3d):

View file

@ -1,4 +1,4 @@
from Nametag3d import Nametag3d from .Nametag3d import Nametag3d
class NametagFloat3d(Nametag3d): class NametagFloat3d(Nametag3d):

View file

@ -1,9 +1,9 @@
from panda3d.core import * from panda3d.core import *
import NametagGlobals from . import NametagGlobals
from Nametag2d import Nametag2d from .Nametag2d import Nametag2d
from Nametag3d import Nametag3d from .Nametag3d import Nametag3d
from _constants import * from ._constants import *
class NametagGroup: class NametagGroup:
@ -282,7 +282,7 @@ class NametagGroup:
def addNametag(self, nametag): def addNametag(self, nametag):
if nametag.m_group: if nametag.m_group:
print 'Attempt to add %s twice to %s.' % (nametag.__class__.__name__, self.m_name) print('Attempt to add %s twice to %s.' % (nametag.__class__.__name__, self.m_name))
return return
nametag.m_group = self nametag.m_group = self
@ -294,7 +294,7 @@ class NametagGroup:
def removeNametag(self, nametag): def removeNametag(self, nametag):
if not nametag.m_group: if not nametag.m_group:
print 'Attempt to removed %s twice from %s.' % (nametag.__class__.__name__, self.m_name) print('Attempt to removed %s twice from %s.' % (nametag.__class__.__name__, self.m_name))
return return
if self.m_manager: if self.m_manager:

View file

@ -1,5 +1,5 @@
from ClickablePopup import * from .ClickablePopup import *
from MarginPopup import * from .MarginPopup import *
class WhisperPopup(ClickablePopup, MarginPopup): class WhisperPopup(ClickablePopup, MarginPopup):

View file

@ -1,13 +1,13 @@
import NametagGlobals from . import NametagGlobals
from ChatBalloon import ChatBalloon from .ChatBalloon import ChatBalloon
from ClickablePopup import ClickablePopup from .ClickablePopup import ClickablePopup
from MarginManager import MarginManager from .MarginManager import MarginManager
from MarginPopup import MarginPopup from .MarginPopup import MarginPopup
from Nametag import Nametag from .Nametag import Nametag
from Nametag2d import Nametag2d from .Nametag2d import Nametag2d
from Nametag3d import Nametag3d from .Nametag3d import Nametag3d
from NametagFloat2d import NametagFloat2d from .NametagFloat2d import NametagFloat2d
from NametagFloat3d import NametagFloat3d from .NametagFloat3d import NametagFloat3d
from NametagGroup import NametagGroup from .NametagGroup import NametagGroup
from WhisperPopup import WhisperPopup from .WhisperPopup import WhisperPopup
from _constants import * from ._constants import *

View file

@ -1,4 +1,4 @@
from libpandadna import * from libpandadna import *
from pets.CPetBrain import CPetBrain from .pets.CPetBrain import CPetBrain
from pets.CPetChase import CPetChase from .pets.CPetChase import CPetChase
from pets.CPetFlee import CPetFlee from .pets.CPetFlee import CPetFlee

View file

@ -15,7 +15,7 @@ def getLanguage():
print('OTPLocalizer: Running in language: %s' % language) print('OTPLocalizer: Running in language: %s' % language)
if language == 'english': if language == 'english':
_languageModule = 'otp.otpbase.OTPLocalizer' + string.capitalize(language) _languageModule = 'otp.otpbase.OTPLocalizer' + language.capitalize()
else: else:
checkLanguage = 1 checkLanguage = 1
_languageModule = 'otp.otpbase.OTPLocalizer_' + language _languageModule = 'otp.otpbase.OTPLocalizer_' + language

View file

@ -3,7 +3,7 @@ import sys
__all__ = ['enumerate', 'nonRepeatingRandomList', 'describeException', 'pdir', 'choice'] __all__ = ['enumerate', 'nonRepeatingRandomList', 'describeException', 'pdir', 'choice']
if not hasattr(__builtin__, 'enumerate'): if not hasattr(builtins, 'enumerate'):
def enumerate(L): def enumerate(L):
"""Returns (0, L[0]), (1, L[1]), etc., allowing this syntax: """Returns (0, L[0]), (1, L[1]), etc., allowing this syntax:
for i, item in enumerate(L): for i, item in enumerate(L):
@ -148,7 +148,7 @@ def quantizeVec(vec, divisor):
vec[2] = quantize(vec[2], divisor) vec[2] = quantize(vec[2], divisor)
def isClient(): def isClient():
if hasattr(__builtin__, 'simbase') and not hasattr(__builtin__, 'base'): if hasattr(builtins, 'simbase') and not hasattr(builtins, 'base'):
return False return False
return True return True

View file

@ -15,7 +15,7 @@ from .CogdoFlyingUtil import swapAvatarShadowPlacer
from . import CogdoUtil from . import CogdoUtil
from . import CogdoFlyingGameGlobals as Globals from . import CogdoFlyingGameGlobals as Globals
class CogdoFlyingLegalEagle(DirectObject, FSM): class CogdoFlyingLegalEagle(FSM, DirectObject):
CollSphereName = 'CogdoFlyingLegalEagleSphere' CollSphereName = 'CogdoFlyingLegalEagleSphere'
CollisionEventName = 'CogdoFlyingLegalEagleCollision' CollisionEventName = 'CogdoFlyingLegalEagleCollision'
InterestCollName = 'CogdoFlyingLegalEagleInterestCollision' InterestCollName = 'CogdoFlyingLegalEagleInterestCollision'

View file

@ -135,7 +135,6 @@ class FireworkShowMixin:
def restoreCameraLens(self): def restoreCameraLens(self):
hood = self.getHood() hood = self.getHood()
from toontown.hood import *
if isinstance(hood, OZHood.OZHood): if isinstance(hood, OZHood.OZHood):
base.camLens.setFar(SpeedwayCameraFar) base.camLens.setFar(SpeedwayCameraFar)
elif isinstance(hood, GSHood.GSHood): elif isinstance(hood, GSHood.GSHood):
@ -177,7 +176,6 @@ class FireworkShowMixin:
self.fireworkShow.begin(timeStamp) self.fireworkShow.begin(timeStamp)
self.fireworkShow.reparentTo(root) self.fireworkShow.reparentTo(root)
hood = self.getHood() hood = self.getHood()
from toontown.hood import *
if isinstance(hood, TTHood.TTHood): if isinstance(hood, TTHood.TTHood):
self.fireworkShow.setPos(150, 0, 80) self.fireworkShow.setPos(150, 0, 80)
self.fireworkShow.setHpr(90, 0, 0) self.fireworkShow.setHpr(90, 0, 0)

View file

@ -298,7 +298,7 @@ if ACCELERATOR_USED_FROM_SHTIKER_BOOK:
del PlantAttributes[202] del PlantAttributes[202]
def getTreeTrackAndLevel(typeIndex): def getTreeTrackAndLevel(typeIndex):
track = typeIndex / 7 track = int(typeIndex / 7)
level = typeIndex % 7 level = typeIndex % 7
return (track, level) return (track, level)

View file

@ -1,5 +1,4 @@
import time import time
from sets import Set
from pandac.PandaModules import Vec3, Vec4, Point3, TextNode, VBase4 from pandac.PandaModules import Vec3, Vec4, Point3, TextNode, VBase4
from direct.gui.DirectGui import DirectFrame, DirectButton, DirectLabel, DirectScrolledList, DirectCheckButton from direct.gui.DirectGui import DirectFrame, DirectButton, DirectLabel, DirectScrolledList, DirectCheckButton
from direct.gui import DirectGuiGlobals from direct.gui import DirectGuiGlobals
@ -14,7 +13,7 @@ from toontown.parties import PartyUtils
from toontown.parties.PartyEditorGrid import PartyEditorGrid from toontown.parties.PartyEditorGrid import PartyEditorGrid
from toontown.parties.PartyEditorListElement import PartyEditorListElement from toontown.parties.PartyEditorListElement import PartyEditorListElement
class PartyEditor(DirectObject, FSM): class PartyEditor(FSM, DirectObject):
notify = directNotify.newCategory('PartyEditor') notify = directNotify.newCategory('PartyEditor')
def __init__(self, partyPlanner, parent): def __init__(self, partyPlanner, parent):
@ -172,13 +171,13 @@ class PartyEditor(DirectObject, FSM):
def getMutuallyExclusiveActivities(self): def getMutuallyExclusiveActivities(self):
currentActivities = self.partyEditorGrid.getActivitiesOnGrid() currentActivities = self.partyEditorGrid.getActivitiesOnGrid()
actSet = Set([]) actSet = set([])
for act in currentActivities: for act in currentActivities:
actSet.add(act[0]) actSet.add(act[0])
result = None result = None
for mutuallyExclusiveTuples in PartyGlobals.MutuallyExclusiveActivities: for mutuallyExclusiveTuples in PartyGlobals.MutuallyExclusiveActivities:
mutSet = Set(mutuallyExclusiveTuples) mutSet = set(mutuallyExclusiveTuples)
inter = mutSet.intersection(actSet) inter = mutSet.intersection(actSet)
if len(inter) > 1: if len(inter) > 1:
result = inter result = inter

View file

@ -49,7 +49,7 @@ def clear():
def readFile(filename): def readFile(filename):
global curId global curId
scriptFile = StreamReader(vfs.openReadFile(filename, 1), 1) scriptFile = StreamReader(vfs.openReadFile(filename, 1), 1)
gen = tokenize.generate_tokens(scriptFile.readline) gen = tokenize.tokenize(scriptFile.readline)
line = getLineOfTokens(gen) line = getLineOfTokens(gen)
while line is not None: while line is not None:
if line == []: if line == []:
@ -73,7 +73,7 @@ def getLineOfTokens(gen):
if token[0] == tokenize.ENDMARKER: if token[0] == tokenize.ENDMARKER:
return None return None
while token[0] != tokenize.NEWLINE and token[0] != tokenize.NL: while token[0] != tokenize.NEWLINE and token[0] != tokenize.NL:
if token[0] == tokenize.COMMENT: if token[0] in (tokenize.COMMENT, tokenize.ENCODING):
pass pass
elif token[0] == tokenize.OP and token[1] == '-': elif token[0] == tokenize.OP and token[1] == '-':
nextNeg = 1 nextNeg = 1

View file

@ -27,7 +27,7 @@ BTA_OPTIONS = PythonUtil.Enum('Ok', -1)
KS_TEXT_SIZE_BIG = TTLocalizer.KSGtextSizeBig KS_TEXT_SIZE_BIG = TTLocalizer.KSGtextSizeBig
KS_TEXT_SIZE_SMALL = TTLocalizer.KSGtextSizeSmall KS_TEXT_SIZE_SMALL = TTLocalizer.KSGtextSizeSmall
class KartShopGuiMgr(object, DirectObject.DirectObject): class KartShopGuiMgr(DirectObject.DirectObject, object):
notify = DirectNotifyGlobal.directNotify.newCategory('KartShopGuiMgr') notify = DirectNotifyGlobal.directNotify.newCategory('KartShopGuiMgr')
class MainMenuDlg(DirectFrame): class MainMenuDlg(DirectFrame):

View file

@ -15,6 +15,7 @@ from toontown.toonbase import ToontownGlobals
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from otp.otpbase import OTPGlobals from otp.otpbase import OTPGlobals
from direct.showbase import PythonUtil from direct.showbase import PythonUtil
from random import *
class DistributedFindFour(DistributedNode.DistributedNode): class DistributedFindFour(DistributedNode.DistributedNode):
@ -605,7 +606,6 @@ class DistributedFindFour(DistributedNode.DistributedNode):
else: else:
hasfound = False hasfound = False
while hasfound == False: while hasfound == False:
from random import *
x = randint(0, 6) x = randint(0, 6)
if self.board[0][x] == 0: if self.board[0][x] == 0:
self.d_requestMove(x) self.d_requestMove(x)

View file

@ -337,7 +337,7 @@ def loadPhaseAnims(phaseStr = 'phase_3', loadFlag = 1):
base.localAvatar.unloadAnims([anim[0]], 'torso', None) base.localAvatar.unloadAnims([anim[0]], 'torso', None)
for key in list(HeadDict.keys()): for key in list(HeadDict.keys()):
if string.find(key, 'd') >= 0: if key.find('d') >= 0:
for anim in animList: for anim in animList:
if loadFlag: if loadFlag:
pass pass
@ -382,7 +382,7 @@ def compileGlobalAnimList():
TorsoAnimDict[key][anim[0]] = file TorsoAnimDict[key][anim[0]] = file
for key in list(HeadDict.keys()): for key in list(HeadDict.keys()):
if string.find(key, 'd') >= 0: if key.find('d') >= 0:
HeadAnimDict.setdefault(key, {}) HeadAnimDict.setdefault(key, {})
for anim in animList: for anim in animList:
file = phaseStr + HeadDict[key] + anim[1] file = phaseStr + HeadDict[key] + anim[1]

View file

@ -15,7 +15,7 @@ def getLanguage():
print('TTLocalizer: Running in language: %s' % language) print('TTLocalizer: Running in language: %s' % language)
if language == 'english': if language == 'english':
_languageModule = 'toontown.toonbase.TTLocalizer' + string.capitalize(language) _languageModule = 'toontown.toonbase.TTLocalizer' + language.capitalize()
else: else:
checkLanguage = 1 checkLanguage = 1
_languageModule = 'toontown.toonbase.TTLocalizer_' + language _languageModule = 'toontown.toonbase.TTLocalizer_' + language

View file

@ -1,7 +1,6 @@
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from pandac.PandaModules import ConfigVariableBool from pandac.PandaModules import ConfigVariableBool
from direct.task import Task from direct.task import Task
from string import maketrans
import pickle import pickle
import os import os
import sys import sys
@ -136,7 +135,7 @@ class DataStore:
self.close() self.close()
if self.wantAnyDbm: if self.wantAnyDbm:
lt = time.asctime(time.localtime()) lt = time.asctime(time.localtime())
trans = maketrans(': ', '__') trans = ': '.maketrans('__')
t = lt.translate(trans) t = lt.translate(trans)
head, tail = os.path.split(self.filepath) head, tail = os.path.split(self.filepath)
newFileName = 'UDStoreBak' + t newFileName = 'UDStoreBak' + t