mcg: call idle_player() after login

This commit is contained in:
coderkun 2012-06-20 02:22:09 +02:00
parent bfe4ae4236
commit 72ea078a1f

11
mcg.py
View file

@ -14,7 +14,7 @@ from threading import Thread
class MCGClient: class MCGClient:
SIGNAL_CONNECT = 'connect' SIGNAL_CONNECT = 'connect'
SIGNAL_IDLE = 'idle' SIGNAL_IDLE = 'idle'
SIGNAL_IDLE_PLAYER = 'idlePlayer' SIGNAL_IDLE_PLAYER = 'idle_player'
SIGNAL_UPDATE = 'update' SIGNAL_UPDATE = 'update'
@ -45,6 +45,7 @@ class MCGClient:
self._connected = True self._connected = True
self._callback(self.SIGNAL_CONNECT, self._connected, None) self._callback(self.SIGNAL_CONNECT, self._connected, None)
self.update() self.update()
self.idle_player()
except IOError as e: except IOError as e:
self._connected = False self._connected = False
self._callback(self.SIGNAL_CONNECT, self._connected, e) self._callback(self.SIGNAL_CONNECT, self._connected, e)
@ -107,7 +108,7 @@ class MCGClient:
return return
if 'player' in modules: if 'player' in modules:
self._idlePlayer() self._idle_player()
if 'database' in modules: if 'database' in modules:
# TODO update DB # TODO update DB
pass pass
@ -119,7 +120,11 @@ class MCGClient:
pass pass
def _idlePlayer(self): def idle_player(self):
self._add_action(self._idle_player)
def _idle_player(self):
if not self._has_callback(self.SIGNAL_IDLE_PLAYER): if not self._has_callback(self.SIGNAL_IDLE_PLAYER):
return return
status = self._client.status() status = self._client.status()