launcher: More cleanup
This commit is contained in:
parent
e2cae7d76e
commit
80362a1d25
2 changed files with 8 additions and 55 deletions
|
@ -505,10 +505,6 @@ class OTPClientRepository(ClientRepositoryBase):
|
||||||
self.startReaderPollTask()
|
self.startReaderPollTask()
|
||||||
if not __astron__:
|
if not __astron__:
|
||||||
self.startHeartbeat()
|
self.startHeartbeat()
|
||||||
newInstall = launcher.getIsNewInstallation()
|
|
||||||
newInstall = base.config.GetBool('new-installation', newInstall)
|
|
||||||
if newInstall:
|
|
||||||
self.notify.warning('new installation')
|
|
||||||
self.loginFSM.request('login')
|
self.loginFSM.request('login')
|
||||||
|
|
||||||
@report(types=['args', 'deltaStamp'], dConfigParam='teleport')
|
@report(types=['args', 'deltaStamp'], dConfigParam='teleport')
|
||||||
|
@ -524,7 +520,6 @@ class OTPClientRepository(ClientRepositoryBase):
|
||||||
def __handleLoginDone(self, doneStatus):
|
def __handleLoginDone(self, doneStatus):
|
||||||
mode = doneStatus['mode']
|
mode = doneStatus['mode']
|
||||||
if mode == 'success':
|
if mode == 'success':
|
||||||
self.setIsNotNewInstallation()
|
|
||||||
self.loginFSM.request('waitForGameList')
|
self.loginFSM.request('waitForGameList')
|
||||||
elif mode == 'getChatPassword':
|
elif mode == 'getChatPassword':
|
||||||
self.loginFSM.request('parentPassword')
|
self.loginFSM.request('parentPassword')
|
||||||
|
@ -570,7 +565,6 @@ class OTPClientRepository(ClientRepositoryBase):
|
||||||
def __handleCreateAccountDone(self, doneStatus):
|
def __handleCreateAccountDone(self, doneStatus):
|
||||||
mode = doneStatus['mode']
|
mode = doneStatus['mode']
|
||||||
if mode == 'success':
|
if mode == 'success':
|
||||||
self.setIsNotNewInstallation()
|
|
||||||
self.loginFSM.request('waitForGameList')
|
self.loginFSM.request('waitForGameList')
|
||||||
elif mode == 'reject':
|
elif mode == 'reject':
|
||||||
self.loginFSM.request('reject')
|
self.loginFSM.request('reject')
|
||||||
|
@ -1903,9 +1897,6 @@ class OTPClientRepository(ClientRepositoryBase):
|
||||||
def __handleCancelWaiting(self, value):
|
def __handleCancelWaiting(self, value):
|
||||||
self.loginFSM.request('shutdown')
|
self.loginFSM.request('shutdown')
|
||||||
|
|
||||||
def setIsNotNewInstallation(self):
|
|
||||||
launcher.setIsNotNewInstallation()
|
|
||||||
|
|
||||||
def renderFrame(self):
|
def renderFrame(self):
|
||||||
gsg = base.win.getGsg()
|
gsg = base.win.getGsg()
|
||||||
if gsg:
|
if gsg:
|
||||||
|
|
|
@ -34,14 +34,11 @@ class LauncherBase(DirectObject):
|
||||||
GameLogFilenameKey = 'GAMELOG_FILENAME'
|
GameLogFilenameKey = 'GAMELOG_FILENAME'
|
||||||
PandaWindowOpenKey = 'PANDA_WINDOW_OPEN'
|
PandaWindowOpenKey = 'PANDA_WINDOW_OPEN'
|
||||||
PandaErrorCodeKey = 'PANDA_ERROR_CODE'
|
PandaErrorCodeKey = 'PANDA_ERROR_CODE'
|
||||||
NewInstallationKey = 'IS_NEW_INSTALLATION'
|
|
||||||
LastLoginKey = 'LAST_LOGIN'
|
LastLoginKey = 'LAST_LOGIN'
|
||||||
UserLoggedInKey = 'USER_LOGGED_IN'
|
UserLoggedInKey = 'USER_LOGGED_IN'
|
||||||
PaidUserLoggedInKey = 'PAID_USER_LOGGED_IN'
|
PaidUserLoggedInKey = 'PAID_USER_LOGGED_IN'
|
||||||
ReferrerKey = 'REFERRER_CODE'
|
ReferrerKey = 'REFERRER_CODE'
|
||||||
PeriodTimeRemainingKey = 'PERIOD_TIME_REMAINING'
|
PeriodTimeRemainingKey = 'PERIOD_TIME_REMAINING'
|
||||||
PeriodNameKey = 'PERIOD_NAME'
|
|
||||||
SwidKey = 'SWID'
|
|
||||||
DISLTokenKey = 'DISLTOKEN'
|
DISLTokenKey = 'DISLTOKEN'
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -56,7 +53,9 @@ class LauncherBase(DirectObject):
|
||||||
ltime[4],
|
ltime[4],
|
||||||
ltime[5])
|
ltime[5])
|
||||||
logPrefix = self.getLogFileName() + '-'
|
logPrefix = self.getLogFileName() + '-'
|
||||||
logfile = logPrefix + logSuffix + '.log'
|
if not os.path.exists('logs/'):
|
||||||
|
os.makedirs('logs/')
|
||||||
|
logfile = os.path.join('logs', logPrefix + logSuffix + '.log')
|
||||||
self.errorfile = 'errorCode'
|
self.errorfile = 'errorCode'
|
||||||
log = open(logfile, 'a')
|
log = open(logfile, 'a')
|
||||||
logOut = LogAndOutput(sys.__stdout__, log)
|
logOut = LogAndOutput(sys.__stdout__, log)
|
||||||
|
@ -72,7 +71,6 @@ class LauncherBase(DirectObject):
|
||||||
if config.GetBool('log-private-info', 0):
|
if config.GetBool('log-private-info', 0):
|
||||||
print('os.environ = ', os.environ)
|
print('os.environ = ', os.environ)
|
||||||
self.miniTaskMgr = MiniTaskManager()
|
self.miniTaskMgr = MiniTaskManager()
|
||||||
self.setServerVersion(launcherConfig.GetString('server-version', 'no_version_set'))
|
|
||||||
self.nout = MultiplexStream()
|
self.nout = MultiplexStream()
|
||||||
Notify.ptr().setOstreamPtr(self.nout, 0)
|
Notify.ptr().setOstreamPtr(self.nout, 0)
|
||||||
self.nout.addFile(Filename(logfile))
|
self.nout.addFile(Filename(logfile))
|
||||||
|
@ -81,28 +79,24 @@ class LauncherBase(DirectObject):
|
||||||
sys.stdout.console = True
|
sys.stdout.console = True
|
||||||
sys.stderr.console = True
|
sys.stderr.console = True
|
||||||
self.notify = directNotify.newCategory('Launcher')
|
self.notify = directNotify.newCategory('Launcher')
|
||||||
self.clock = TrueClock.getGlobalPtr()
|
|
||||||
self.logPrefix = logPrefix
|
self.logPrefix = logPrefix
|
||||||
self.testServerFlag = self.getTestServerFlag()
|
self.testServerFlag = self.getTestServerFlag()
|
||||||
self.notify.info('isTestServer: %s' % self.testServerFlag)
|
self.notify.info('isTestServer: %s' % self.testServerFlag)
|
||||||
self.gameServer = self.getGameServer()
|
gameServer = self.getGameServer() or '127.0.0.1'
|
||||||
self.notify.info('Game Server %s' % self.gameServer)
|
self.notify.info('Game Server %s' % gameServer)
|
||||||
self.goUserName = ''
|
self.goUserName = ''
|
||||||
self.lastLauncherMsg = None
|
self.lastLauncherMsg = None
|
||||||
self.setRegistry(self.GameLogFilenameKey, logfile)
|
self.setRegistry(self.GameLogFilenameKey, logfile)
|
||||||
self.showPhase = 3.5
|
self.showPhase = 3.5
|
||||||
self.currentPhase = 4
|
self.currentPhase = 4
|
||||||
if self.getServerVersion() == 'no_version_set':
|
serverVersion = launcherConfig.GetString('server-version', 'no_version_set')
|
||||||
|
if serverVersion == 'no_version_set':
|
||||||
self.setPandaErrorCode(10)
|
self.setPandaErrorCode(10)
|
||||||
self.notify.info('Aborting, Configrc did not run!')
|
self.notify.info('Aborting, config did not load!')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
self.launcherMessage(self.Localizer.LauncherStartingMessage)
|
self.launcherMessage(self.Localizer.LauncherStartingMessage)
|
||||||
self.http = HTTPClient()
|
self.http = HTTPClient()
|
||||||
self.foreground()
|
self.foreground()
|
||||||
return
|
|
||||||
|
|
||||||
def getTime(self):
|
|
||||||
return self.clock.getShortTime()
|
|
||||||
|
|
||||||
def isDummy(self):
|
def isDummy(self):
|
||||||
return 0
|
return 0
|
||||||
|
@ -145,15 +139,6 @@ class LauncherBase(DirectObject):
|
||||||
self.miniTaskMgr = None
|
self.miniTaskMgr = None
|
||||||
return task.done
|
return task.done
|
||||||
|
|
||||||
def _addMiniTask(self, task, name):
|
|
||||||
if not self.miniTaskMgr:
|
|
||||||
self.notify.info('Restarting mini task manager.')
|
|
||||||
self.miniTaskMgr = MiniTaskManager()
|
|
||||||
from direct.task.TaskManagerGlobal import taskMgr
|
|
||||||
taskMgr.remove('miniTaskManager')
|
|
||||||
taskMgr.add(self._stepMiniTaskManager, 'miniTaskManager')
|
|
||||||
self.miniTaskMgr.add(task, name)
|
|
||||||
|
|
||||||
def newTaskManager(self):
|
def newTaskManager(self):
|
||||||
self.taskMgrStarted = True
|
self.taskMgrStarted = True
|
||||||
if self.miniTaskMgr.running:
|
if self.miniTaskMgr.running:
|
||||||
|
@ -186,8 +171,6 @@ class LauncherBase(DirectObject):
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
def isDownloadComplete(self):
|
def isDownloadComplete(self):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -202,12 +185,6 @@ class LauncherBase(DirectObject):
|
||||||
def recordPeriodTimeRemaining(self, secondsRemaining):
|
def recordPeriodTimeRemaining(self, secondsRemaining):
|
||||||
self.setValue(self.PeriodTimeRemainingKey, int(secondsRemaining))
|
self.setValue(self.PeriodTimeRemainingKey, int(secondsRemaining))
|
||||||
|
|
||||||
def recordPeriodName(self, periodName):
|
|
||||||
self.setValue(self.PeriodNameKey, periodName)
|
|
||||||
|
|
||||||
def recordSwid(self, swid):
|
|
||||||
self.setValue(self.SwidKey, swid)
|
|
||||||
|
|
||||||
def getGoUserName(self):
|
def getGoUserName(self):
|
||||||
return self.goUserName
|
return self.goUserName
|
||||||
|
|
||||||
|
@ -238,20 +215,6 @@ class LauncherBase(DirectObject):
|
||||||
self.disconnectCode = newCode
|
self.disconnectCode = newCode
|
||||||
self.disconnectMsg = newMsg
|
self.disconnectMsg = newMsg
|
||||||
|
|
||||||
def setServerVersion(self, version):
|
|
||||||
self.ServerVersion = version
|
|
||||||
|
|
||||||
def getServerVersion(self):
|
|
||||||
return self.ServerVersion
|
|
||||||
|
|
||||||
def getIsNewInstallation(self):
|
|
||||||
result = self.getValue(self.NewInstallationKey, 1)
|
|
||||||
result = base.config.GetBool('new-installation', result)
|
|
||||||
return result
|
|
||||||
|
|
||||||
def setIsNotNewInstallation(self):
|
|
||||||
self.setValue(self.NewInstallationKey, 0)
|
|
||||||
|
|
||||||
def getLastLogin(self):
|
def getLastLogin(self):
|
||||||
return self.getValue(self.LastLoginKey, '')
|
return self.getValue(self.LastLoginKey, '')
|
||||||
|
|
||||||
|
@ -276,7 +239,6 @@ class LauncherBase(DirectObject):
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
self.notify.info('cleanup: cleaning up Launcher')
|
self.notify.info('cleanup: cleaning up Launcher')
|
||||||
self.ignoreAll()
|
self.ignoreAll()
|
||||||
del self.clock
|
|
||||||
del self.http
|
del self.http
|
||||||
|
|
||||||
def getBlue(self):
|
def getBlue(self):
|
||||||
|
|
Loading…
Reference in a new issue