general: undo some questional python 3.x conversions

This commit is contained in:
John Cote 2020-01-08 21:22:39 -05:00
parent 6bbd89c342
commit b03e2d6171
12 changed files with 16 additions and 26 deletions

View file

@ -20,7 +20,7 @@ class SuitPlannerInteriorAI:
self.dbg_defaultSuitType = None self.dbg_defaultSuitType = None
else: else:
self.dbg_defaultSuitType = SuitDNA.getSuitType(dbg_defaultSuitName) self.dbg_defaultSuitType = SuitDNA.getSuitType(dbg_defaultSuitName)
if isinstance(bldgLevel, bytes): if isinstance(bldgLevel, str):
self.notify.warning('bldgLevel is a string!') self.notify.warning('bldgLevel is a string!')
bldgLevel = int(bldgLevel) bldgLevel = int(bldgLevel)
self._genSuitInfos(numFloors, bldgLevel, bldgTrack) self._genSuitInfos(numFloors, bldgLevel, bldgTrack)

View file

@ -3,7 +3,7 @@ from .CatalogAccessoryItemGlobals import *
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer
from toontown.toon import ToonDNA from toontown.toon import ToonDNA
import random, types import random
from direct.showbase import PythonUtil from direct.showbase import PythonUtil
from direct.gui.DirectGui import * from direct.gui.DirectGui import *
from pandac.PandaModules import * from pandac.PandaModules import *
@ -231,7 +231,7 @@ class CatalogAccessoryItem(CatalogItem.CatalogItem):
def applyColor(self, model, color): def applyColor(self, model, color):
if model == None or color == None: if model == None or color == None:
return return
if isinstance(color, bytes): if isinstance(color, str):
tex = loader.loadTexture(color) tex = loader.loadTexture(color)
tex.setMinfilter(Texture.FTLinearMipmapLinear) tex.setMinfilter(Texture.FTLinearMipmapLinear)
tex.setMagfilter(Texture.FTLinear) tex.setMagfilter(Texture.FTLinear)

View file

@ -5,7 +5,6 @@ from toontown.toonbase import ToontownGlobals
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from direct.distributed.PyDatagram import PyDatagram from direct.distributed.PyDatagram import PyDatagram
from direct.distributed.PyDatagramIterator import PyDatagramIterator from direct.distributed.PyDatagramIterator import PyDatagramIterator
import types
import sys import sys
CatalogReverseType = None CatalogReverseType = None
CatalogItemVersion = 8 CatalogItemVersion = 8
@ -333,7 +332,7 @@ class CatalogItem:
matches = model.findAllMatches(partName) matches = model.findAllMatches(partName)
if color == None: if color == None:
matches.hide() matches.hide()
elif isinstance(color, bytes): elif isinstance(color, str):
tex = loader.loadTexture(color) tex = loader.loadTexture(color)
tex.setMinfilter(Texture.FTLinearMipmapLinear) tex.setMinfilter(Texture.FTLinearMipmapLinear)
tex.setMagfilter(Texture.FTLinear) tex.setMagfilter(Texture.FTLinear)

View file

@ -1,6 +1,5 @@
from . import CatalogItem from . import CatalogItem
from pandac.PandaModules import * from pandac.PandaModules import *
import types
from direct.distributed.PyDatagram import PyDatagram from direct.distributed.PyDatagram import PyDatagram
from direct.distributed.PyDatagramIterator import PyDatagramIterator from direct.distributed.PyDatagramIterator import PyDatagramIterator
@ -10,7 +9,7 @@ class CatalogItemList:
self.store = store self.store = store
self.__blob = None self.__blob = None
self.__list = None self.__list = None
if isinstance(source, bytes): if isinstance(source, str):
self.__blob = source self.__blob = source
elif isinstance(source, list): elif isinstance(source, list):
self.__list = source[:] self.__list = source[:]

View file

@ -16,7 +16,6 @@ from direct.tkwidgets import Valuator
from direct.tkwidgets import VectorWidgets from direct.tkwidgets import VectorWidgets
from otp.level import LevelConstants from otp.level import LevelConstants
from direct.directtools import DirectSession from direct.directtools import DirectSession
import types
import Pmw import Pmw
class InGameEditor(AppShell): class InGameEditor(AppShell):
@ -376,7 +375,7 @@ class InGameEditor(AppShell):
label = Label(frame, text=attribName, width=15, anchor=W, justify=LEFT) label = Label(frame, text=attribName, width=15, anchor=W, justify=LEFT)
label.pack(side=LEFT, expand=0) label.pack(side=LEFT, expand=0)
for choice in params.get('choiceSet', []): for choice in params.get('choiceSet', []):
if type(choice) is bytes: if type(choice) is str:
choiceStr = choice choiceStr = choice
else: else:
choiceStr = repr(choice) choiceStr = repr(choice)
@ -427,7 +426,7 @@ class InGameEditor(AppShell):
print('SENDING', value) print('SENDING', value)
self.level.setAttribEdit(entId, attribName, value) self.level.setAttribEdit(entId, attribName, value)
if type(choice) is bytes: if type(choice) is str:
labelStr = choice labelStr = choice
else: else:
labelStr = repr(choice) labelStr = repr(choice)

View file

@ -1,4 +1,3 @@
import types
import time import time
from pandac.PandaModules import * from pandac.PandaModules import *
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
@ -467,7 +466,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
dclass = self.dclassesByName[dclassName] dclass = self.dclassesByName[dclassName]
pad.avatar.updateAllRequiredFields(dclass, di) pad.avatar.updateAllRequiredFields(dclass, di)
gotData = 1 gotData = 1
if isinstance(pad.func, bytes): if isinstance(pad.func, str):
messenger.send(pad.func, list((gotData, pad.avatar) + pad.args)) messenger.send(pad.func, list((gotData, pad.avatar) + pad.args))
else: else:
pad.func(*(gotData, pad.avatar) + pad.args) pad.func(*(gotData, pad.avatar) + pad.args)

View file

@ -1,7 +1,6 @@
import os import os
import sys import sys
import time import time
import types
ltime = 1 and time.localtime() ltime = 1 and time.localtime()
logSuffix = '%02d%02d%02d_%02d%02d%02d' % (ltime[0] - 2000, ltime[1], ltime[2], logSuffix = '%02d%02d%02d_%02d%02d%02d' % (ltime[0] - 2000, ltime[1], ltime[2],
@ -152,7 +151,7 @@ class ToontownLauncher(LauncherBase):
t = type(value) t = type(value)
if t == int: if t == int:
WindowsRegistry.setIntValue(self.toontownRegistryKey, name, value) WindowsRegistry.setIntValue(self.toontownRegistryKey, name, value)
elif t == bytes: elif t == str:
WindowsRegistry.setStringValue(self.toontownRegistryKey, name, value) WindowsRegistry.setStringValue(self.toontownRegistryKey, name, value)
else: else:
self.notify.warning('setRegistry: Invalid type for registry value: ' + repr(value)) self.notify.warning('setRegistry: Invalid type for registry value: ' + repr(value))

View file

@ -13,7 +13,6 @@ from toontown.toonbase import TTLocalizer
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from direct.showbase import PythonUtil from direct.showbase import PythonUtil
import random import random
import types
Component2IconDict = {'boredom': 'Bored', Component2IconDict = {'boredom': 'Bored',
'restlessness': None, 'restlessness': None,
'playfulness': 'Play', 'playfulness': 'Play',
@ -633,7 +632,7 @@ class Pet(Avatar.Avatar):
def getInteractIval(self, interactId): def getInteractIval(self, interactId):
anims = self.InteractAnims[interactId] anims = self.InteractAnims[interactId]
if type(anims) == bytes: if type(anims) == str:
animIval = ActorInterval(self, anims) animIval = ActorInterval(self, anims)
else: else:
animIval = Sequence() animIval = Sequence()

View file

@ -1,6 +1,5 @@
from direct.showbase.PythonUtil import Enum, invertDictLossless from direct.showbase.PythonUtil import Enum, invertDictLossless
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
import types
import random import random
Tricks = Enum('JUMP, BEG, PLAYDEAD, ROLLOVER, BACKFLIP, DANCE, SPEAK, BALK,') Tricks = Enum('JUMP, BEG, PLAYDEAD, ROLLOVER, BACKFLIP, DANCE, SPEAK, BALK,')
NonHappyMinActualTrickAptitude = 0.1 NonHappyMinActualTrickAptitude = 0.1
@ -62,7 +61,7 @@ TrickSounds = {Tricks.BACKFLIP: 'phase_5/audio/sfx/backflip.mp3',
def getSoundIval(trickId): def getSoundIval(trickId):
sounds = TrickSounds.get(trickId, None) sounds = TrickSounds.get(trickId, None)
if sounds: if sounds:
if type(sounds) == bytes: if type(sounds) == str:
sound = loader.loadSfx(sounds) sound = loader.loadSfx(sounds)
return SoundInterval(sound) return SoundInterval(sound)
else: else:
@ -79,7 +78,7 @@ def getTrickIval(pet, trickId):
anims = TrickAnims[trickId] anims = TrickAnims[trickId]
animRate = random.uniform(0.9, 1.1) animRate = random.uniform(0.9, 1.1)
waitTime = random.uniform(0.0, 1.0) waitTime = random.uniform(0.0, 1.0)
if type(anims) == bytes: if type(anims) == str:
if trickId == Tricks.JUMP: if trickId == Tricks.JUMP:
animIval = Parallel() animIval = Parallel()
animIval.append(ActorInterval(pet, anims, playRate=animRate)) animIval.append(ActorInterval(pet, anims, playRate=animRate))

View file

@ -14,7 +14,6 @@ from . import SuitDNA
from toontown.battle import BattleProps from toontown.battle import BattleProps
from direct.showbase.PythonUtil import Functor from direct.showbase.PythonUtil import Functor
import string import string
import types
GenericModel = 'phase_9/models/char/bossCog' GenericModel = 'phase_9/models/char/bossCog'
ModelDict = {'s': 'phase_9/models/char/sellbotBoss', ModelDict = {'s': 'phase_9/models/char/sellbotBoss',
'm': 'phase_10/models/char/cashbotBoss', 'm': 'phase_10/models/char/cashbotBoss',
@ -535,7 +534,7 @@ class BossCog(Avatar.Avatar):
self.raised = 1 self.raised = 1
elif anim == 'Fb_fall': elif anim == 'Fb_fall':
ival = Parallel(ActorInterval(self, 'Fb_fall'), Sequence(SoundInterval(self.reelSfx, node=self), SoundInterval(self.deathSfx))) ival = Parallel(ActorInterval(self, 'Fb_fall'), Sequence(SoundInterval(self.reelSfx, node=self), SoundInterval(self.deathSfx)))
elif isinstance(anim, bytes): elif isinstance(anim, str):
ival = ActorInterval(self, anim) ival = ActorInterval(self, anim)
else: else:
ival = anim ival = anim

View file

@ -3,7 +3,6 @@ from direct.interval.IntervalGlobal import *
from otp.otpbase import OTPLocalizer from otp.otpbase import OTPLocalizer
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer
from otp.otpbase import OTPLocalizer from otp.otpbase import OTPLocalizer
import types
from direct.showbase import PythonUtil from direct.showbase import PythonUtil
from pandac.PandaModules import * from pandac.PandaModules import *
from libotp import * from libotp import *
@ -563,7 +562,7 @@ class TTEmote(Emote.Emote):
self.unlockStateChangeMsg() self.unlockStateChangeMsg()
def disable(self, index, toon): def disable(self, index, toon):
if isinstance(index, bytes): if isinstance(index, str):
index = OTPLocalizer.EmoteFuncDict[index] index = OTPLocalizer.EmoteFuncDict[index]
self.emoteFunc[index][1] = self.emoteFunc[index][1] + 1 self.emoteFunc[index][1] = self.emoteFunc[index][1] + 1
if toon is base.localAvatar: if toon is base.localAvatar:
@ -571,7 +570,7 @@ class TTEmote(Emote.Emote):
self.emoteEnableStateChanged() self.emoteEnableStateChanged()
def enable(self, index, toon): def enable(self, index, toon):
if isinstance(index, bytes): if isinstance(index, str):
index = OTPLocalizer.EmoteFuncDict[index] index = OTPLocalizer.EmoteFuncDict[index]
self.emoteFunc[index][1] = self.emoteFunc[index][1] - 1 self.emoteFunc[index][1] = self.emoteFunc[index][1] - 1
if toon is base.localAvatar: if toon is base.localAvatar:

View file

@ -25,7 +25,6 @@ from toontown.effects import DustCloud
from direct.showbase.PythonUtil import Functor from direct.showbase.PythonUtil import Functor
from toontown.distributed import DelayDelete from toontown.distributed import DelayDelete
from . import AccessoryGlobals from . import AccessoryGlobals
import types
import importlib import importlib
import functools import functools
@ -2196,7 +2195,7 @@ class Toon(Avatar.Avatar, ToonHead):
for partName, pieceNames in pieces: for partName, pieceNames in pieces:
part = self.getPart(partName, lodName) part = self.getPart(partName, lodName)
if part: if part:
if type(pieceNames) == bytes: if type(pieceNames) == str:
pieceNames = (pieceNames,) pieceNames = (pieceNames,)
for pieceName in pieceNames: for pieceName in pieceNames:
npc = part.findAllMatches('**/%s;+s' % pieceName) npc = part.findAllMatches('**/%s;+s' % pieceName)