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.CMover import CMover
from movement.CMoverGroup import CMoverGroup
from nametag import *
from settings.Settings import Settings
from .movement.CImpulse import CImpulse
from .movement.CMover import CMover
from .movement.CMoverGroup import CMoverGroup
from .nametag import *
from .settings.Settings import Settings

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,9 +1,9 @@
from panda3d.core import *
import NametagGlobals
from Nametag2d import Nametag2d
from Nametag3d import Nametag3d
from _constants import *
from . import NametagGlobals
from .Nametag2d import Nametag2d
from .Nametag3d import Nametag3d
from ._constants import *
class NametagGroup:
@ -282,7 +282,7 @@ class NametagGroup:
def addNametag(self, nametag):
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
nametag.m_group = self
@ -294,7 +294,7 @@ class NametagGroup:
def removeNametag(self, nametag):
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
if self.m_manager:

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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