general: Some small fixes
This commit is contained in:
parent
4ae72453e7
commit
f497c3d011
5 changed files with 62 additions and 7 deletions
1
astron/.gitignore
vendored
Normal file
1
astron/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
bin/
|
|
@ -64,9 +64,9 @@ class LoginScreen(StateData.StateData, GuiScreen.GuiScreen):
|
||||||
linePos -= buttonLineHeight
|
linePos -= buttonLineHeight
|
||||||
self.dialogDoneEvent = 'loginDialogAck'
|
self.dialogDoneEvent = 'loginDialogAck'
|
||||||
dialogClass = OTPGlobals.getGlobalDialogClass()
|
dialogClass = OTPGlobals.getGlobalDialogClass()
|
||||||
self.dialog = dialogClass(dialogName='loginDialog', doneEvent=self.dialogDoneEvent, message='', style=OTPDialog.Acknowledge, sortOrder=NO_FADE_SORT_INDEX + 100)
|
self.dialog = dialogClass(dialogName='loginDialog', doneEvent=self.dialogDoneEvent, message='', style=OTPDialog.Acknowledge, sortOrder=DGG.NO_FADE_SORT_INDEX + 100)
|
||||||
self.dialog.hide()
|
self.dialog.hide()
|
||||||
self.failDialog = DirectFrame(parent=aspect2dp, relief=DGG.RAISED, borderWidth=(0.01, 0.01), pos=(0, 0.1, 0), text='', text_scale=0.08, text_pos=(0.0, 0.3), text_wordwrap=15, sortOrder=NO_FADE_SORT_INDEX)
|
self.failDialog = DirectFrame(parent=aspect2dp, relief=DGG.RAISED, borderWidth=(0.01, 0.01), pos=(0, 0.1, 0), text='', text_scale=0.08, text_pos=(0.0, 0.3), text_wordwrap=15, sortOrder=DGG.NO_FADE_SORT_INDEX)
|
||||||
linePos = -.05
|
linePos = -.05
|
||||||
self.failTryAgainButton = DirectButton(parent=self.failDialog, relief=DGG.RAISED, borderWidth=(0.01, 0.01), pos=(0, 0, linePos), scale=0.9, text=OTPLocalizer.LoginScreenTryAgain, text_scale=0.06, text_pos=(0, -.02), command=self.__handleFailTryAgain)
|
self.failTryAgainButton = DirectButton(parent=self.failDialog, relief=DGG.RAISED, borderWidth=(0.01, 0.01), pos=(0, 0, linePos), scale=0.9, text=OTPLocalizer.LoginScreenTryAgain, text_scale=0.06, text_pos=(0, -.02), command=self.__handleFailTryAgain)
|
||||||
linePos -= buttonLineHeight
|
linePos -= buttonLineHeight
|
||||||
|
@ -75,7 +75,7 @@ class LoginScreen(StateData.StateData, GuiScreen.GuiScreen):
|
||||||
self.failDialog.hide()
|
self.failDialog.hide()
|
||||||
self.connectionProblemDialogDoneEvent = 'loginConnectionProblemDlgAck'
|
self.connectionProblemDialogDoneEvent = 'loginConnectionProblemDlgAck'
|
||||||
dialogClass = OTPGlobals.getGlobalDialogClass()
|
dialogClass = OTPGlobals.getGlobalDialogClass()
|
||||||
self.connectionProblemDialog = dialogClass(dialogName='connectionProblemDialog', doneEvent=self.connectionProblemDialogDoneEvent, message='', style=OTPDialog.Acknowledge, sortOrder=NO_FADE_SORT_INDEX + 100)
|
self.connectionProblemDialog = dialogClass(dialogName='connectionProblemDialog', doneEvent=self.connectionProblemDialogDoneEvent, message='', style=OTPDialog.Acknowledge, sortOrder=DGG.NO_FADE_SORT_INDEX + 100)
|
||||||
self.connectionProblemDialog.hide()
|
self.connectionProblemDialog.hide()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
import __builtin__
|
import __builtin__
|
||||||
|
import sys
|
||||||
|
|
||||||
|
__all__ = ['describeException', 'pdir']
|
||||||
|
|
||||||
# class 'decorator' that records the stack at the time of creation
|
# class 'decorator' that records the stack at the time of creation
|
||||||
# be careful with this, it creates a StackTrace, and that can take a
|
# be careful with this, it creates a StackTrace, and that can take a
|
||||||
|
@ -22,6 +25,56 @@ def recordCreationStack(cls):
|
||||||
cls.printCreationStackTrace = printCreationStackTrace
|
cls.printCreationStackTrace = printCreationStackTrace
|
||||||
return cls
|
return cls
|
||||||
|
|
||||||
|
def describeException(backTrace = 4):
|
||||||
|
# When called in an exception handler, returns a string describing
|
||||||
|
# the current exception.
|
||||||
|
|
||||||
|
def byteOffsetToLineno(code, byte):
|
||||||
|
# Returns the source line number corresponding to the given byte
|
||||||
|
# offset into the indicated Python code module.
|
||||||
|
|
||||||
|
import array
|
||||||
|
lnotab = array.array('B', code.co_lnotab)
|
||||||
|
|
||||||
|
line = code.co_firstlineno
|
||||||
|
for i in range(0, len(lnotab), 2):
|
||||||
|
byte -= lnotab[i]
|
||||||
|
if byte <= 0:
|
||||||
|
return line
|
||||||
|
line += lnotab[i+1]
|
||||||
|
|
||||||
|
return line
|
||||||
|
|
||||||
|
infoArr = sys.exc_info()
|
||||||
|
exception = infoArr[0]
|
||||||
|
exceptionName = getattr(exception, '__name__', None)
|
||||||
|
extraInfo = infoArr[1]
|
||||||
|
trace = infoArr[2]
|
||||||
|
|
||||||
|
stack = []
|
||||||
|
while trace.tb_next:
|
||||||
|
# We need to call byteOffsetToLineno to determine the true
|
||||||
|
# line number at which the exception occurred, even though we
|
||||||
|
# have both trace.tb_lineno and frame.f_lineno, which return
|
||||||
|
# the correct line number only in non-optimized mode.
|
||||||
|
frame = trace.tb_frame
|
||||||
|
module = frame.f_globals.get('__name__', None)
|
||||||
|
lineno = byteOffsetToLineno(frame.f_code, frame.f_lasti)
|
||||||
|
stack.append("%s:%s, " % (module, lineno))
|
||||||
|
trace = trace.tb_next
|
||||||
|
|
||||||
|
frame = trace.tb_frame
|
||||||
|
module = frame.f_globals.get('__name__', None)
|
||||||
|
lineno = byteOffsetToLineno(frame.f_code, frame.f_lasti)
|
||||||
|
stack.append("%s:%s, " % (module, lineno))
|
||||||
|
|
||||||
|
description = ""
|
||||||
|
for i in range(len(stack) - 1, max(len(stack) - backTrace, 0) - 1, -1):
|
||||||
|
description += stack[i]
|
||||||
|
|
||||||
|
description += "%s: %s" % (exceptionName, extraInfo)
|
||||||
|
return description
|
||||||
|
|
||||||
def pdir(obj, str = None, width = None,
|
def pdir(obj, str = None, width = None,
|
||||||
fTruncate = 1, lineWidth = 75, wantPrivate = 0):
|
fTruncate = 1, lineWidth = 75, wantPrivate = 0):
|
||||||
# Remove redundant class entries
|
# Remove redundant class entries
|
||||||
|
|
|
@ -148,7 +148,7 @@ class ToonBase(OTPBase.OTPBase):
|
||||||
self.canScreenShot = 1
|
self.canScreenShot = 1
|
||||||
self.glitchCount = 0
|
self.glitchCount = 0
|
||||||
self.walking = 0
|
self.walking = 0
|
||||||
self.resetMusic = self.loadMusic('phase_3/audio/bgm/MIDI_Events_16channels.mid')
|
self.resetMusic = self.loader.loadMusic('phase_3/audio/bgm/MIDI_Events_16channels.mid')
|
||||||
self.oldX = max(1, base.win.getXSize())
|
self.oldX = max(1, base.win.getXSize())
|
||||||
self.oldY = max(1, base.win.getYSize())
|
self.oldY = max(1, base.win.getYSize())
|
||||||
self.aspectRatio = float(self.oldX) / self.oldY
|
self.aspectRatio = float(self.oldX) / self.oldY
|
||||||
|
@ -308,11 +308,12 @@ class ToonBase(OTPBase.OTPBase):
|
||||||
self.notify.info('Using gameServer from launcher: %s ' % gameServer)
|
self.notify.info('Using gameServer from launcher: %s ' % gameServer)
|
||||||
else:
|
else:
|
||||||
gameServer = 'localhost'
|
gameServer = 'localhost'
|
||||||
serverPort = base.config.GetInt('server-port', 6667)
|
serverPort = base.config.GetInt('server-port', 7198)
|
||||||
serverList = []
|
serverList = []
|
||||||
for name in gameServer.split(';'):
|
for name in gameServer.split(';'):
|
||||||
url = URLSpec(name, 1)
|
url = URLSpec(name, 1)
|
||||||
url.setScheme('s')
|
if config.GetBool('server-want-ssl', False):
|
||||||
|
url.setScheme('s')
|
||||||
if not url.hasPort():
|
if not url.hasPort():
|
||||||
url.setPort(serverPort)
|
url.setPort(serverPort)
|
||||||
serverList.append(url)
|
serverList.append(url)
|
||||||
|
|
|
@ -112,6 +112,6 @@ if autoRun and launcher.isDummy() and (not Thread.isTrueThreads() or __name__ ==
|
||||||
except SystemExit:
|
except SystemExit:
|
||||||
raise
|
raise
|
||||||
except:
|
except:
|
||||||
from direct.showbase import PythonUtil
|
from otp.otpbase import PythonUtil
|
||||||
print PythonUtil.describeException()
|
print PythonUtil.describeException()
|
||||||
raise
|
raise
|
||||||
|
|
Loading…
Reference in a new issue